Newbie to Postgres
Hi All
I have been given a postgres machine to look after. I need to get a backup sorted out and trying to use pg_dump. When every I try to use it I get an error even with just the basics of pg_dump databasename. We are running 9.1 error below ERROR: syntax error at or near "pg_dump" LINE 1: pg_dump testdatabase Any advise would be good. Thanks |
Run full vacuum before dumping.
Check if your pg_dump is the same or higher version than DB is running! |
Are you running pg_dump from a command prompt or a script? Either way what are the exact commands being used?
|
It's a new build of postgres so would guess it's the correct verion of pg_dump but the pg_dump --version doe snot display any info.
|
I am running it from the command prompt before I get as far as scripting it. I have been on the postgressql manual and tried almost every option so the question is more of what have I not tried.
|
When you built postgres from source. PG_DUMP is in /usr/local/pgsql/bin/pg_dump or anywhere you've been setting in --prefix. Be aware, /usr/bin/pg_dump can contain different version, that has been installed with your system.
If 'pg_dump --version' doesn't show anything then something is really wrong. Type the full path when you are running pg_dump. |
Can you post the command that resulted in
Code:
ERROR: syntax error at or near "pg_dump" |
Ok my pg_dump seems to be located in /usr/pgsql-9.1/bin. When run from this location with the --version I still get nothing.
I get the ERROR: syntax error at or near "pg_dump" LINE 1: pg_dump testdatabase when trying to run the most basic of commands pg_dump customers; or pg_dump customers -U data; or pg_dump -U data customers; Thanks |
The error messages suggest that pg_dump is a script (and they are not bash error messages).
What is pg_dump? On Debian Squeeze it is symlinked to a Perl script: Code:
docoll@CW8vDS:~$ type pg_dump |
Thanks catkin, although I am a little confused by that.
I am not running any script just su postgres psql pg_dump database; Hope this helps |
Sorry to confuse. The bash type builtin command and the file binary command can be used as shown at the command prompt to determine what is run in response to using a particular command at the command prompt.
I did not know it was possible to run pg_dump from within an interactive PostgreSQL session. Maybe it's not and hence the error message. What happens if you try running it at the command prompt? |
Ok looks like I had the wrong end of the stick.
Trying from the command line seems to give me results. Thanks for the advise catkin |
All times are GMT -5. The time now is 08:03 PM. |