So I do most of my database stuff in MySQL these days... but every now and then I'm forced to use PostgreSQL for the GIS functionality.
First thing to do when using pg from bash is to make your ".pgpass" file which is a one liner in this format:
and set the permissions:
Then these commands are at your finger tips:
psql -h pgserver.example.com -d db -U user
pgsql2shp -h pgserver.example.com -u user db $t1
pg_dump -h pgserver.example.com -U user -t $t1
First thing to do when using pg from bash is to make your ".pgpass" file which is a one liner in this format:
hostname:port:database:username:password
and set the permissions:
echo "pgserver.example.com:*:db:user:YourPassord" > ~/.pgpass
chmod 0600 ~/.pgpassThen these commands are at your finger tips:
psql -h pgserver.example.com -d db -U user
pgsql2shp -h pgserver.example.com -u user db $t1
pg_dump -h pgserver.example.com -U user -t $t1
Defining these variables (in, for example, your .bashrc file) save remembering them:
ReplyDeletePGDATABASE
PGHOST
PGOPTIONS
PGPORT
PGUSER