Toto je starší verze dokumentu!
Import & Export
Export
to .psql je ve skutecnosti csv soubor
copy(select * from author_roles where attributes→>'activity_Id' != '') to '/tmp/cr_author_roles.psql'; copy(select * from distributors where id = 6) to '/tmp/cr_distributors.psql'; copy(select * from flags where id in (2,6)) to '/tmp/cr_flags.psql';
Import
- musim byt jako su postgres
- pokud to nejde tak je v .bashrc spatnej alias ze su sudo
- pak se pusti prikaz COPY other_tbl FROM '/path/to/file.csv';
Reset autoincrementu
SELECT setval('distributors_id_seq',(SELECT GREATEST(MAX(id)+1,nextval('distributors_id_seq'))-1 FROM distributors));
Dump struktury
pg_dump -d core --clean --create --schema-only > /tmp/core-schema.psql