Tuesday, October 28, 2008

PgSQL: random notes

postgres, allow localhost with no password
on line: with host all all md5
change md5 to trust

postgres, set new password
[user@server ~]psql -U postgres -h localhost -d postgres
ALTER USER postgres WITH PASSWORD 'newpass';

#where postgres is the dbname
pgsql -U postgres -d dbname

# (at pgsql prompt) this will give the schema of the table
dbname=# \d tablename

# (at pgsql prompt) view autoincrement expression for field
dbname=# \d tablename

# (at pgsql prompt) how to view next autoincrement number
dbname=# select nextval('tablename_fieldname_seq');

# (at pgsql prompt) how to set autoincrement number
dbname=# select setval('tablename_fieldname_seq', 50);

source(s): http://www.source.com

No comments: