Reputation: 3362
I have a table created like this:
CREATE TABLE testing.table_comparison_summaries
(
ID SERIAL
, reference_database_name varchar(255)
, reference_schema_name varchar(255)
, reference_table_name varchar(255)
, reference_deleted_row_count INT
, compare_database_name varchar(255)
, compare_schema_name varchar(255)
, compare_table_name varchar(255)
, compare_changed_row_count INT
, compare_new_row_count INT
, comparison_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
, CONSTRAINT pk_table_comparison_summaries PRIMARY KEY (id)
)
;
I want to restart the ID value as it's a table I'm doing a trunc/reload on.
I saw this thread: Reset PostgreSQL primary key to 1 , but it is not working for me.
The command I am using is this:
ALTER SEQUENCE
table_comparison_summaries id seq RESTART WITH 1;
What am I doing wrong?
Upvotes: 1
Views: 997
Reputation: 3362
Here is some useful documentation: https://popsql.com/learn-sql/postgresql/how-to-alter-sequence-in-postgresql
The correct code to run was
ALTER SEQUENCE
testing.table_comparison_summaries_id_seq RESTART WITH 1;
In PGAdmin, off to the left, you can see a list of sequences for that schema. Use that.
Upvotes: 1