New answers tagged psql
In PostgreSQL (as described in documentation, The Information Schema): SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema='public'; For MySQL you would need table_schema='dbName' and for MSSQL remove that condition. Notice that "only those tables and views are shown that the current user has access to". Also, ...
Try an extra layer of quotes around your variables: psql -d mydb -U me -h localhost -f db_log.sql -v db_user_string="'Me'" -v version="'1.7.3'"
\c prints something like You are now connected to database "foobar" as user "squanderer". Use this if you don't mind creating a new connection, because this is what happens. The \connect (shortened as \c) without all parameters will create a new connection identical to your current one. The current connection is closed. See the \connect command spec on ...
Top 50 recent answers are included