Re-initializing table sequence in postgresql

March 15, 2011

Re-initializing a table sequence is quite normal and required in some cases. I had to do that recently. If the table has data and needs to be preserved, then temporarily you have to move the data, delete the data in original table and re-initialize the sequence and copy the original data again. Use copy column names to reinitialize key sequence. In current versions of PostgreSQL you can specify column names with the COPY command to copy in or out only specific columns. ... Read more

© 2017 | Follow on Twitter