What is a query that will show me the full definition, including indexes and keys for a SQL Server table? I want a pure query - and know that SQL Studio can give this to me
"Note that I really do want the DDL that defines the table."
use pg_dump:
pg_dump -s -t tablename dbname
It gives you the table definition (-s
is schema only, no data) of
a certain table ( -t
tablename ) in database "dbname"
in plain SQL.
Additionally you will get sequence, primary key and constraint info.
The output you can -maybe after checking and editing according to your needs-
be fed again into (the same or another) Postgres database:
pg_dump -s -t tablename dbname1 > /tmp/foo.sql
psql -e dbname2 < /tmp/foo.sql
This is for UNIX/Linux, but I'm sure, that a pg_dump also exists for Windows.