postgres:postgresql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgres:postgresql [2009/04/06 08:11] – deva | postgres:postgresql [2011/01/25 07:44] (current) – deva | ||
---|---|---|---|
Line 2: | Line 2: | ||
=====Open sql cli interface====== | =====Open sql cli interface====== | ||
< | < | ||
- | psql -U [username] -W [password] | + | psql -U [username] -W [database] |
</ | </ | ||
Line 18: | Line 18: | ||
=====Import/ | =====Import/ | ||
< | < | ||
- | psql -U [username] -W [password] < dump.sql | + | psql -U [username] -W [dbname] < dump.sql |
pg_dump -U [username] -h localhost [-t [table]] [dbname] > dump.sql | pg_dump -U [username] -h localhost [-t [table]] [dbname] > dump.sql | ||
+ | </ | ||
+ | |||
+ | =====Cut prefix from table===== | ||
+ | < | ||
+ | ALTER TABLE data ALTER COLUMN filename TYPE character varying(255) USING substring(filename from 20); | ||
+ | </ | ||
+ | |||
+ | =====Find missing foreign key values===== | ||
+ | < | ||
+ | SELECT foo.xcpr FROM (SELECT a.personid AS xcpr, b.personid AS ycpr FROM examinations AS a LEFT OUTER JOIN person AS b ON a.personid = b.personid) AS foo WHERE foo.ycpr IS NULL; | ||
+ | </ | ||
+ | |||
+ | =====Disable pager (less/more) in psql===== | ||
+ | < | ||
+ | \pset pager | ||
</ | </ |
postgres/postgresql.txt · Last modified: 2011/01/25 07:44 by deva