1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-09-10 04:33:31 +02:00

psql: split examples, minor fixes

This commit is contained in:
Igor Shubovych 2014-05-12 14:44:31 +03:00
parent 77be8f37bf
commit 82564bd222

View file

@ -2,18 +2,18 @@
> PostgreSQL command-line client > PostgreSQL command-line client
- Connect to database. It connects to localhost using default port *5432* with default user. - Connect to *database*. It connects to localhost using default port *5432* with default user
`psql {{database}}` `psql {{database}}`
- Connect to database on given server host running on given port with username given - Connect to *database* on given server *host* running on given *port* with *username* given
`psql -h {{host}} -p {{port}} -U {{username}} mydb` `psql -h {{host}} -p {{port}} -U {{username}} {{database}}`
- Run query against the given database - Run single *query* against the given *database*. Note: useful in shell scripts
`echo '{{query}}' | psql {{database}}`
or
`psql -c '{{query}}' {{database}}` `psql -c '{{query}}' {{database}}`
- Run semicolon-separated *queries* against the given *database*. Note: useful in shell scripts
`echo '{{queries}}' | psql {{database}}`