5

I connect to my postgres server using psql "service=subscription". How do I use the service with pg_dump?

I tried to do the following: pg_dump -h "service=subscription" > /home/fogest/dump.out

This however did not work.

How should I be doing this?

Edit: The error when I do the following:

pg_dump -h "service=subscription" odyssey_prod > /u3/jhvisser/dump.out
pg_dump: [archiver (db)] connection to database "odyssey_prod" failed: could not translate host name "service=subscription" to address: Name or service not known
Randall
  • 329
  • 2
  • 18
ComputerLocus
  • 193
  • 4
  • 12

1 Answers1

6

You can't use -h to specify a connection-string. It can only be an actual hostname or IP.

To connect to a service (or use any other connection string) just pass it as a non-switch argument:

psql "service=subscription"

or (I know this is counter-intuitive) pass it as the database name:

psql -d "service=subscription"
Craig Ringer
  • 11,083
  • 9
  • 40
  • 61