Thread: Problems with pg_dump
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does anybody know why when I try : pg_dump DATABASE > DATABASE.out with postgres, root, or any other user it simply says: "sh: DATABASE.out permission denied" Thanks in advance for your help. Josep Sànchez [papapep] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13 iD8DBQE9/gwE2vx52x0kyz4RAusLAJ909w2S2Y9m9RqDYLygBY8uwMdxdgCgiAPF Od9wsS6fc1swg8WYEUsNaj8= =bkRX -----END PGP SIGNATURE-----
On Mon, 16 Dec 2002, papapep wrote: > Does anybody know why when I try : > > pg_dump DATABASE > DATABASE.out > > with postgres, root, or any other user it simply says: > > "sh: DATABASE.out permission denied" Well, if you hadn't mentioned root, I would say that whatever user didn't have permission to write in the current directory. But, if root is also effected, I would guess something to do with the device. Is the device this directory is part of, either mounted read-only (first guess) or full? Gord -- Matter Realisations http://www.materialisations.com/ Gordon Haverland, B.Sc. M.Eng. President 101 9504 182 St. NW Edmonton, AB, CA T5T 3A7 780/481-8019 ghaverla @ freenet.edmonton.ab.ca 780/993-1274 (alt.)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Well, if you hadn't mentioned root, I would say that whatever > user didn't have permission to write in the current directory. > But, if root is also effected, I would guess something to do with > the device. Is the device this directory is part of, either > mounted read-only (first guess) or full? It's something really strange. The disk isn't full, and in the directory I want the dump file to be written it appears a DATABASE.out file, but empty :-/ I'm really confused.... Thanks in advance Josep Sàncehz [papapep] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13 iD8DBQE9/hPn2vx52x0kyz4RArZ6AJ0XnR+S8mwnji8qu9L3acf/hCv9cwCgheET X6KkXoK7Nx287Jrie4RTJ8A= =RNUx -----END PGP SIGNATURE-----
I forgot to tell you that the DATABASE.out file is a read only file. I don-t know if its important, but.... Thanks in advance Josep Sàncehz [papapep]
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've also noticed that if I just make pg_dump to the standard output (screen) it works fine. But in the moment I try to redirect it to any file ( > DATABASE.out) it fails as I told before. Strange, isn't it? Josep Sànchez [papapep] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13 iD8DBQE9/hpe2vx52x0kyz4RApvrAJ9YrcaWQHso0Z3MwsQPxdLAN8xUUQCfdM+r KPNBb2uFV0iHfy8EprR3zj0= =9fXZ -----END PGP SIGNATURE-----
On Mon, 2002-12-16 at 18:24, papapep wrote: > I've also noticed that if I just make pg_dump to the standard output > (screen) it works fine. But in the moment I try to redirect it to any > file ( > DATABASE.out) it fails as I told before. > > Strange, isn't it? Can you redirect any other file? For example: echo success > /tmp/junk echo success > DATABASE.out -- Oliver Elphick <olly@lfix.co.uk> LFIX Limited
papapep <papapep@gmx.net> writes: > I forgot to tell you that the DATABASE.out file is a read only file. I > don-t know if its important, but.... You mean you're doing pg_dump ... >DATABASE.out where DATABASE.out already exists and is marked read-only? No wonder it's failing. Read-only status wouldn't be much protection if it didn't fail, no? Remove the old file, or chmod it to let you overwrite it. regards, tom lane
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > You mean you're doing > pg_dump ... >DATABASE.out Right > where DATABASE.out already exists and is marked read-only? No. It exists after doing pg_dump....etc,etc.. Before I've removed it to avoid these problems. No wonder > it's failing. Read-only status wouldn't be much protection if it didn't > fail, no? Of course.. :-D But the question is, how is that pg_dump creates a file with read-only permissions?....astonishing for me....is it the default profile?? It isn't written in any of the docs I've read about it. Josep Sànchez [papapep] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13 iD8DBQE9/ikM2vx52x0kyz4RAo8cAJ9cBmHQsl14z6JthjmwJmLTowCMZACcD37R 0i9O67tnCyDQEpO0FbAJN8k= =fJhR -----END PGP SIGNATURE-----
On Mon, 16 Dec 2002, papapep wrote: > I forgot to tell you that the DATABASE.out file is a read only file. I > don-t know if its important, but.... The DATABASE.out file is owned by root? In your shell initialization scripts, do you have the "noclobber" variable set? It's there to keep you from accidentally overwriting files by using the shell redirection operators. If you really do want to overwrite the file (lose the old data), just delete the file and try again. Then noclobber won't get involved. Gord -- Matter Realisations http://www.materialisations.com/ Gordon Haverland, B.Sc. M.Eng. President 101 9504 182 St. NW Edmonton, AB, CA T5T 3A7 780/481-8019 ghaverla @ freenet.edmonton.ab.ca 780/993-1274 (alt.)
papapep <papapep@gmx.net> writes: >>> You mean you're doing >>> pg_dump ... >DATABASE.out >>> where DATABASE.out already exists and is marked read-only? > No. It exists after doing pg_dump....etc,etc.. Before I've removed it > to avoid these problems. That's odd. > But the question is, how is that pg_dump creates a file with > read-only permissions?....astonishing for me....is it the default > profile?? It isn't written in any of the docs I've read about it. Well, pg_dump is not creating the file in this situation --- your shell is. So it's got to have something to do with shell settings. May I inquire what you have "umask" set to? Also, just exactly what permissions is the file created with (ls -l output would be good). regards, tom lane
At 04:19 PM 12/16/02 -0500, Tom Lane wrote: >papapep <papapep@gmx.net> writes: > >>> You mean you're doing > >>> pg_dump ... >DATABASE.out > >>> where DATABASE.out already exists and is marked read-only? > > > No. It exists after doing pg_dump....etc,etc.. Before I've removed it > > to avoid these problems. > >That's odd. > > > But the question is, how is that pg_dump creates a file with > > read-only permissions?....astonishing for me....is it the default > > profile?? It isn't written in any of the docs I've read about it. > >Well, pg_dump is not creating the file in this situation --- your shell >is. So it's got to have something to do with shell settings. May I >inquire what you have "umask" set to? Also, just exactly what >permissions is the file created with (ls -l output would be good). ls -ld . would be useful too. Could have setuid on for someone other than the user. Mark Thomas --- thomas@pbegames.com ----> http://www.pbegames.com/~thomas Play by Electron Games -> http://www.pbegames.com Free Trial Games
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 First of all thanks to all the people that has tried to help me. In second stage, I've done most of the things you've told me: - - Delete the DATABASE.out - - Set the permissions to 0777 in the destination directory (they where already 0777, but I repeated the chmod command to . - - The umask is 022. - - ls -l: -rw-r--r-- 1 postgres postgres 43363 Dec 16 20:20 DATABASE.out - -ls -ld: drwxrwxrwx 2 directory directory 4096 Dec 16 20:23 - - And also I've tried to redirect to several filenames. The good new is that now is working fine. The bad one is that I'm not really sure which one of the things I've done has solved it. :-/ At least is somebody has any similar problem he can try to repeat the steps I've done. Thanks once again. Josep Sànchez [papapep] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13 iD8DBQE9/xl52vx52x0kyz4RAuKPAJ9YAHeZy5NfBj2b4GZAB8pj/wQdBACeMurA u54aOZA98BXlfWF1AqyeubA= =SPXC -----END PGP SIGNATURE-----