Re: Looking for a "show create table " equivalent - Mailing list pgsql-sql

From Jasen Betts
Subject Re: Looking for a "show create table " equivalent
Date
Msg-id ivmg0m$2ip$1@reversiblemaps.ath.cx
Whole thread Raw
In response to Looking for a "show create table " equivalent  ("B.Rathmann" <B.Rathmann@ping.de>)
Responses Re: Looking for a "show create table " equivalent  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-sql
On 2011-07-12, B.Rathmann <B.Rathmann@ping.de> wrote:
> Hello,
>
> I've been trying to find out how to find out which sql was run to create
> a certain table. 

That's like trying to find what change was used to create $1.83 

there several possible answers all but one of them wrong, but many of
them may .

> As I need this in a program which may access the database remotely,
> using pg_dump --schema-only or psql is not an option
> (the system my program runs on may not even have those tools installed).

why do you think you need this information?

> Looking at the source of pgadmin3 it seems as if the program collects
> all info about the given table (columns, indeces etc) and creates the
> needed SQL by itself, is there no easier way?
>
> E.g. MySQL offers a simple "show create table <name>". I am using
> Postgresql 9.0.4 on Gentoo.

can you find what you need to know in the information schema?

http://www.postgresql.org/docs/8.4/static/information-schema.html

It's an industry standard, and thus should work with every SQL database.



-- 
⚂⚃ 100% natural



pgsql-sql by date:

Previous
From: "Oliveiros d'Azevedo Cristina"
Date:
Subject: Re: [NOVICE] Compare rows
Next
From: Craig Ringer
Date:
Subject: Re: Looking for a "show create table " equivalent