Toto je starší verze dokumentu!


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

  • it/postgresql/import_export.1445582117.txt.gz
  • Poslední úprava: 2015/10/23 08:35
  • autor: kourim