tags:

views:

58

answers:

2

I have a table created long ago in postgreSQL. Now i want to look at the sql statement used to create it but cannot figure it out.

Also when i do the \dS+ tablename it says table not found, but \dt+ tablename is working fine. The \dS+ lists all the table names owned by the root postgres user and doesn't show up tables that i created with my user account.

Any help is greatly appreciated.

Thanks

A: 

The easiest method I can think of is to install pgAdmin 3 (found here) and use it to view your database. It will automatically generate a query that will create the table in question.

Corin
pgAdmin looks good, but unfortunately I don't have root access to install on the server..
Raja
You don't need to install it on the server. Put it on your desktop and then connect it to the server.
Corin
+2  A: 
pg_dump -t 'aschema.atable' --schema-only

More info - in the manual.

Milen A. Radev
thanks. works great
Raja