PostgreSQL “DESCRIBE TABLE”
Try this (in the psql command-line tool): \d+ tablename See the manual for more info.
Try this (in the psql command-line tool): \d+ tablename See the manual for more info.
Set the PGPASSWORD environment variable inside the script before calling psql PGPASSWORD=pass1234 psql -U MyUsername myDatabaseName For reference, see http://www.postgresql.org/docs/current/static/libpq-envars.html Edit Since Postgres 9.2 there is also the option to specify a connection string or URI that can contain the username and password. Syntax is: $ psql postgresql://[user[:password]@][host][:port][,…][/dbname][?param1=value1&…] Using that is a security risk because … Read more
Statements end with semicolons. In psql, pressing enter without a semicolon continues the statement onto the next line, adding what you wrote to the query buffer rather than executing it. You will notice that the prompt changes from dbname=> to dbname-> to indicate that you’re on a continuation line. regress=> DROP TABLE sometable regress-> \r … Read more