Re: [GENERAL] How to use PG_DUMP?
Hi, I have tested with "pg_dump -u -p 5432 -d -f c:\test.sql mydatabase" but the order of the INSERTS it is not the correct. What PG_DUMP does is to add the CONSTRAINTS after doing the INSERTS. There is a way to have the correct order of the INSERTS? I have tested the COPY but does not insert nothing. What can I do? Best Regards, On Sun, Jan 24, 2010 at 5:22 PM, Tom Lane wrote: > Andre Lopes writes: > > I have generated the CREATE statements using a modeling tool, and I have > > created another database to test the changes. My problem is the order of > the > > INSERT statements generated by PG_DUMP [-a -d], causing errors because of > > the order of the INSERTS. > > If you are talking about foreign key constraint failures, the best way > is to use a regular dump (not -a). pg_dump will order the data and > constraint creations properly then. > >regards, tom lane >
Re: [GENERAL] How to use PG_DUMP?
Andre Lopes writes: > I have generated the CREATE statements using a modeling tool, and I have > created another database to test the changes. My problem is the order of the > INSERT statements generated by PG_DUMP [-a -d], causing errors because of > the order of the INSERTS. If you are talking about foreign key constraint failures, the best way is to use a regular dump (not -a). pg_dump will order the data and constraint creations properly then. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] How to use PG_DUMP?
Hi, I'am having trouble using PG_DUMP. The problem is the following, I have made some minor changes to my database, I have added one table. I have generated the CREATE statements using a modeling tool, and I have created another database to test the changes. My problem is the order of the INSERT statements generated by PG_DUMP [-a -d], causing errors because of the order of the INSERTS. I have tested PG_DUMP [-a] that creates the COPY statements, but no data is added to the tables. How can I solve this? Best Regards,
Re: [GENERAL] how to use pg_dump to dump tables whose owner is me
I'd put them all into the same schema and dump that. pg_dump -n schemaname On Tue, Mar 3, 2009 at 8:30 AM, Roger Chen wrote: > Thanks. If there are many tables owned by me and some other users, are > there any easy ways to do that? > > On Mon, Mar 2, 2009 at 9:23 PM, Scott Marlowe wrote: >> On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen wrote: >>> Hi, >>> Can anyone tell me how to do that? I could find that in man page of >>> pg_dump. Thanks. >> >> pg_dump -t table1 -t table2 >> >> ? >> > -- When fascism comes to America, it will be the intolerant selling it as diversity. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to use pg_dump to dump tables whose owner is me
--- On Tue, 3/3/09, Roger Chen wrote: > >> Hi, > >> Can anyone tell me how to do that? I could find > that in man page of > >> pg_dump. Thanks. > > > > pg_dump -t table1 -t table2 > > > Thanks. If there are many tables owned by me and some other > users, are > there any easy ways to do that? > I would use psql to query all the tables you own to a file, using a query like this: select schemaname || '.' || tablename as to_dump from pg_tables where tableowner = 'myuser' And then use xargs to or similar text tools to generate the pg_dump command you need. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to use pg_dump to dump tables whose owner is me
Thanks. If there are many tables owned by me and some other users, are there any easy ways to do that? On Mon, Mar 2, 2009 at 9:23 PM, Scott Marlowe wrote: > On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen wrote: >> Hi, >> Can anyone tell me how to do that? I could find that in man page of >> pg_dump. Thanks. > > pg_dump -t table1 -t table2 > > ? > -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to use pg_dump to dump tables whose owner is me
On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen wrote: > Hi, > Can anyone tell me how to do that? I could find that in man page of > pg_dump. Thanks. pg_dump -t table1 -t table2 ? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] how to use pg_dump to dump tables whose owner is me
Hi, Can anyone tell me how to do that? I could find that in man page of pg_dump. Thanks. Best, Roger -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to use pg_dump in windows xp
am 31.03.2006, um 18:08:55 +0530 mailte deepak pal folgendes: > hi > i have to create a database script file using pg_dump ,but i do not > understant how to run it under windows enviornment plz hep me and replay mee > soon... execute it via psql, start psql and then \i your_script, or psql -f your_script. HTH, Andreas -- Andreas Kretschmer(Kontakt: siehe Header) Heynitz: 035242/47215, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net ===Schollglas Unternehmensgruppe=== ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[GENERAL] how to use pg_dump in windows xp
hi i have to create a database script file using pg_dump ,but i do not understant how to run it under windows enviornment plz hep me and replay mee soon...
Re: [GENERAL] how to use pg_dump and then restored onto development server
thanks. - Original Message - From: "Matt Van Mater" <[EMAIL PROTECTED]> To: "Zlatko Matic" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 30, 2005 7:25 PM Subject: Re: [GENERAL] how to use pg_dump and then restored onto development server On 6/29/05, Douglas McNaught <[EMAIL PROTECTED]> wrote: "Zlatko Matic" <[EMAIL PROTECTED]> writes: > OK..i get it. It works... > My additional question is: how to incorporate timestamp in dumped file > name ? > Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h > localhost -U postgres MYDB, > so that output file is named something like MYDB_BCP_2005-29-01, for > example. Is that possible? I'm sure it's possible, but I'm not an expert on Windows batch command language. There are some good references for that stuff on the web--check them out. To get the date in a format that should work for you in win2000 and winxp, open a command prompt and type the following command: FOR /F "tokens=2-4 delims=/ " %f IN ('date /t') DO (echo %h-%g-%f) To get the same date format inside a .bat batch script, replace each % sign with two % signs, like this: FOR /F "tokens=2-4 delims=/ " %%f IN ('date /t') DO (echo %%h-%%g-%%f) You can run a similar command to get the current timestamp as well. For more information on how to do this, and to better understand the commands above, open a command prompt and type "for /?"... you will see a help screen on the FOR construct in the windows command shell. enjoy:) Matt ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [GENERAL] how to use pg_dump and then restored onto development server
On 6/29/05, Douglas McNaught <[EMAIL PROTECTED]> wrote: > "Zlatko Matic" <[EMAIL PROTECTED]> writes: > > > OK..i get it. It works... > > My additional question is: how to incorporate timestamp in dumped file > > name ? > > Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h > > localhost -U postgres MYDB, > > so that output file is named something like MYDB_BCP_2005-29-01, for > > example. Is that possible? > > I'm sure it's possible, but I'm not an expert on Windows batch command > language. There are some good references for that stuff on the > web--check them out. > To get the date in a format that should work for you in win2000 and winxp, open a command prompt and type the following command: FOR /F "tokens=2-4 delims=/ " %f IN ('date /t') DO (echo %h-%g-%f) To get the same date format inside a .bat batch script, replace each % sign with two % signs, like this: FOR /F "tokens=2-4 delims=/ " %%f IN ('date /t') DO (echo %%h-%%g-%%f) You can run a similar command to get the current timestamp as well. For more information on how to do this, and to better understand the commands above, open a command prompt and type "for /?"... you will see a help screen on the FOR construct in the windows command shell. enjoy:) Matt ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] how to use pg_dump and then restored onto development server
"Zlatko Matic" <[EMAIL PROTECTED]> writes: > OK..i get it. It works... > My additional question is: how to incorporate timestamp in dumped file > name ? > Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h > localhost -U postgres MYDB, > so that output file is named something like MYDB_BCP_2005-29-01, for > example. Is that possible? I'm sure it's possible, but I'm not an expert on Windows batch command language. There are some good references for that stuff on the web--check them out. -Doug ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] how to use pg_dump and then restored onto development server
OK..i get it. It works... My additional question is: how to incorporate timestamp in dumped file name ? Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U postgres MYDB, so that output file is named something like MYDB_BCP_2005-29-01, for example. Is that possible? Thanks. - Original Message - From: "Douglas McNaught" <[EMAIL PROTECTED]> To: "Zlatko Matic" <[EMAIL PROTECTED]> Cc: "ketan shah" <[EMAIL PROTECTED]>; Sent: Wednesday, June 29, 2005 5:29 PM Subject: Re: [GENERAL] how to use pg_dump and then restored onto development server "Zlatko Matic" <[EMAIL PROTECTED]> writes: Concerning this question about pg_dump, I'm also confused and don't understand when to use pg_restore and when to use psql ? For example, how to restore in these two cases: A) pg_dump -f D:\MYDB_BCP -c -x -h localhost -U postgres MYDB B) pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U postgres MYDB If you use any of the binary dump formats (-Fc or -Ft), use pg_restore. For text dumps (the default) use psql. -Doug ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] how to use pg_dump and then restored onto development server
"Zlatko Matic" <[EMAIL PROTECTED]> writes: > Concerning this question about pg_dump, I'm also confused and don't > understand when to use pg_restore and when to use psql ? > For example, how to restore in these two cases: > A) pg_dump -f D:\MYDB_BCP -c -x -h localhost -U postgres MYDB > B) pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U postgres MYDB If you use any of the binary dump formats (-Fc or -Ft), use pg_restore. For text dumps (the default) use psql. -Doug ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] how to use pg_dump and then restored onto development server
ketan shah <[EMAIL PROTECTED]> writes: > Hi, > > All , > > I am newbie to postgres database. How to take pg_dump from production > database and restore into development server using pg_restore.. > > From documentation, I find that I have to use pg_dump for backup and > pg_restore for restoration. > > My database name is otsdb.. > > For backup*I use command > > Pg_dump otsdb > /home/Ketan/otsdbbkp.out > > But after successfully dump*I can*t see the otsdbbkp.out file in > /home/Ketan/ Do you get any error messages? > If I get otsdbbkp.out file then I copy this file on my development server > and then I issue the following command * > > Psql *d otsdb *f otsdbbkp.out Are those really asterisks rather than dashes? What error message do you get? -Doug ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] how to use pg_dump and then restored onto development server
Concerning this question about pg_dump, I'm also confused and don't understand when to use pg_restore and when to use psql ? For example, how to restore in these two cases: A) pg_dump -f D:\MYDB_BCP -c -x -h localhost -U postgres MYDB B) pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U postgres MYDB Thanks. - Original Message - From: ketan shah To: pgsql-general@postgresql.org Sent: Wednesday, June 29, 2005 4:48 PM Subject: [GENERAL] how to use pg_dump and then restored onto development server Hi, All , I am newbie to postgres database. How to take pg_dump from production database and restore into development server using pg_restore.. From documentation, I find that I have to use pg_dump for backup and pg_restore for restoration. My database name is otsdb.. For backup I use command Pg_dump otsdb > /home/Ketan/otsdbbkp.out But after successfully dump I cant see the otsdbbkp.out file in /home/Ketan/ If I get otsdbbkp.out file then I copy this file on my development server and then I issue the following command Psql d otsdb f otsdbbkp.out (my development server database name is otsdb) pl. help me . If any thing wrong pl. guide me.. Ketan shah __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[GENERAL] how to use pg_dump and then restored onto development server
Hi, All , I am newbie to postgres database. How to take pg_dump from production database and restore into development server using pg_restore.. From documentation, I find that I have to use pg_dump for backup and pg_restore for restoration. My database name is otsdb.. For backup I use command Pg_dump otsdb > /home/Ketan/otsdbbkp.out But after successfully dump I cant see the otsdbbkp.out file in /home/Ketan/ If I get otsdbbkp.out file then I copy this file on my development server and then I issue the following command Psql d otsdb f otsdbbkp.out (my development server database name is otsdb) pl. help me . If any thing wrong pl. guide me.. Ketan shah__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com