Reverse-engineering table creation statements

Started by Thom Brownover 16 years ago4 messagesgeneral
Jump to latest
#1Thom Brown
thombrown@gmail.com

Is there a simple way of generating a creation statement for a table without
using psql or pgAdmin. Basically I'd like to create what pgAdmin III shows
in the SQL pane when you click on a table. MySQL appears to have an
equivalent which is SHOW CREATE table [tablename].

Thanks

Thom

#2Chris Barnes
compuguruchrisbarnes@hotmail.com
In reply to: Thom Brown (#1)
Re: Reverse-engineering table creation statements

pg_dump --schema-only --schema=SCHEMA --table=TABLE

produces creation script.

Chris

http://www.postgresql.org/docs/8.0/interactive/backup.html

From: thombrown@gmail.com
Date: Mon, 14 Sep 2009 16:15:23 +0100
Subject: [GENERAL] Reverse-engineering table creation statements
To: pgsql-general@postgresql.org

Is there a simple way of generating a creation statement for a table without using psql or pgAdmin. Basically I'd like to create what pgAdmin III shows in the SQL pane when you click on a table. MySQL appears to have an equivalent which is SHOW CREATE table [tablename].

Thanks

Thom

_________________________________________________________________
New: Messenger sign-in on the MSN homepage
http://go.microsoft.com/?linkid=9677403

#3Thom Brown
thombrown@gmail.com
In reply to: Chris Barnes (#2)
Re: Reverse-engineering table creation statements

Erk... I forgot to mention I don't wish to use command-line tools either. I
would like to submit something as a query in PHP and get back a result with
the creation script in. This is to modify some existing code which is
currently only supporting MySQL.

Thom

2009/9/14 Chris Barnes <compuguruchrisbarnes@hotmail.com>

Show quoted text

pg_dump --schema-only --schema=SCHEMA --table=TABLE

produces creation script.

Chris

http://www.postgresql.org/docs/8.0/interactive/backup.html

------------------------------
From: thombrown@gmail.com
Date: Mon, 14 Sep 2009 16:15:23 +0100
Subject: [GENERAL] Reverse-engineering table creation statements
To: pgsql-general@postgresql.org

Is there a simple way of generating a creation statement for a table
without using psql or pgAdmin. Basically I'd like to create what pgAdmin
III shows in the SQL pane when you click on a table. MySQL appears to have
an equivalent which is SHOW CREATE table [tablename].

Thanks

Thom

------------------------------
Less clicking: Hotmail access on the new MSN homepage.<http://go.microsoft.com/?linkid=9677398&gt;

#4ries van Twisk
pg@rvt.dds.nl
In reply to: Thom Brown (#3)
Re: Reverse-engineering table creation statements

On Sep 14, 2009, at 10:27 AM, Thom Brown wrote:

Erk... I forgot to mention I don't wish to use command-line tools
either. I would like to submit something as a query in PHP and get
back a result with the creation script in. This is to modify some
existing code which is currently only supporting MySQL.

then call pg_dump from PHP??

or be more specific what you really need...

Ries

Thom

2009/9/14 Chris Barnes <compuguruchrisbarnes@hotmail.com>
pg_dump --schema-only --schema=SCHEMA --table=TABLE

produces creation script.

Chris

http://www.postgresql.org/docs/8.0/interactive/backup.html

From: thombrown@gmail.com
Date: Mon, 14 Sep 2009 16:15:23 +0100
Subject: [GENERAL] Reverse-engineering table creation statements
To: pgsql-general@postgresql.org

Is there a simple way of generating a creation statement for a table
without using psql or pgAdmin. Basically I'd like to create what
pgAdmin III shows in the SQL pane when you click on a table. MySQL
appears to have an equivalent which is SHOW CREATE table [tablename].

Thanks

Thom

Less clicking: Hotmail access on the new MSN homepage.

regards, Ries van Twisk

-------------------------------------------------------------------------------------------------
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS  
WebORB PostgreSQL DB-Architect
email: ries@vantwisk.nl        web:   http://www.rvantwisk.nl/     
skype: callto://r.vantwisk
Phone: +1-810-476-4196    Cell: +593 9901 7694                   SIP:  
+1-747-690-5133