- install postgreSQL
sudo apt install postgresql
- set password :
sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'my_passwordy';
\q
-- SQL query to list all PostgreSQL sequences, their current last_value, and whether they are behind the maximum id in their corresponding tables. | |
-- Useful for debugging duplicate key errors caused by manual inserts or broken auto-increment. | |
SELECT | |
n.nspname AS schema, | |
c.relname AS sequence_name, | |
t.relname AS table_name, | |
a.attname AS column_name, | |
s.last_value, | |
(SELECT MAX(x) FROM ( |
sudo apt install postgresql
sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'my_passwordy';
\q