title: How to bulk update sequence ID postgreSQL for all tables
body: <p>I imported the Postgres SQL file to my server using TablePlus(SQL client), but after I insert new row I got error like this:</p>
  
  <blockquote>
    <p>SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint \"users_pkey\"
    DETAIL:  Key (id)=(1) already exists</p>
  </blockquote>
  
  <p>I know it caused by sequence value is 0 and need to be updated by code below:</p>
  
  <pre><code>SELECT setval(_sequence_name_, max(id)) FROM _table_name_;
  </code></pre>
  
  <p>But it needs so much time if I must write to all table sequences(maybe hundreds of sequences) one by one. So how to update all sequences at once?</p>