Question

I'm using Fedora 17 and pgadmin3 to auto-connect to a postgresql database with one button click.

Every time I want to run an SQL statement, I have to do 4 steps, (open pgadmin3), (connect to the server), (connect to the database), (open a query window), (open a previous file) then FINALLY I can run my SQL statement. I want this all to be done with one click.

pgadmin3 appears to have features to do do all this work for you on the commandline:

el@defiant ~ $ pgadmin3 --help
Usage: pgadmin3 [-h] [-s <str>] [-S] [-Sc <str>] [-q] [-qc <str>] [-f <str>] [-cm <str>] [-ch <str>] [-cp <str>] [-c <str>] [-t]
  -h, --help                            show this help message
  -s, --server=<str>                    auto-connect to specified server
  -S, --serverstatus                    open server status window
  -Sc, --serverstatusconnect=<str>      connect server status window to database
  -q, --query                           open query tool
  -qc, --queryconnect=<str>             connect query tool to database
  -f, --file=<str>                      file to load into the query tool in -q or -qc mode
  -cm:<str>                             edit main configuration file
  -ch:<str>                             edit HBA configuration file
  -cp:<str>                             edit pgpass configuration file
  -c:<str>                              edit configuration files in cluster directory
  -t                                    dialog translation test mode

But I can't get it to work, I can either connect to the database or open the file I want. It doesn't seem to allow me to simultaneously connect to a server, connect to a specific database, open a query window, and open a previous sql file.

What are the proper commands to connect to server, database and open a query editor and load a file into it? I've tried a hundred variations, but pgadmin3 either just does not do anything and does not give an error message, or it does only part of what I told it to do with no error message.

This is the command I'm using, it does open my file, but it connects to the wrong database, and I have to manually change it. The command line option to choose the database does not work.

pgadmin3 --file=/home/el/Desktop/sqlfile_for_postgresql.sql --query --server=defiant

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top