Re: Looking for a "show create table <name>" equivalent

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Looking for a "show create table <name>" equivalent
Date: 2011-07-14 10:22:14
Message-ID: ivmg0m$2ip$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2011-07-12, B.Rathmann <B(dot)Rathmann(at)ping(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Oliveiros d'Azevedo Cristina 2011-07-14 11:30:40 Re: [NOVICE] Compare rows
Previous Message Wes James 2011-07-13 22:45:45 Re: Looking for a "show create table <name>" equivalent