June 2013

archive

reset auto increment counter in postgres Jun
11
1
3

postgres uses something called a sequence to keep track of the auto increment counts. To list the sequences us:

\ds

The sequence name is in the format of ${table}_{variable}_seq

You can reset the counter using the function

setval('product_id_seq', 1453);

or

select setval('product_id_seq', (SELECT MAX(id) FROM product));

If you do not know the name you can use the pg_get_serial_sequence function on the table 

select pg_get_serial_sequence('product', 'id');

You can also manually update the sequence with the command:

ALTER SEQUENCE product_id_seq RESTART WITH 1453;

comments

remove domain from ssh known_hosts file Jun
11
1
3

ssh-keygen -R <domain>
ssh keygen -R example.com
ssh-keygen -R [localhost]:22

comments