pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump using SQL
4+ messages / 4 participants
[nested] [flat]

* pg_dump using SQL
@ 2008-03-18 19:45  Yusnel Rojas García <onemoverx@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Yusnel Rojas García @ 2008-03-18 19:45 UTC (permalink / raw)
  To: pgsql-sql

Hi everyone

Is there any way to do what pg_dump does?, I mean, get the structure of a
table in a database (ex: CREATE TABLE ...)

thanks in advance.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump using SQL
@ 2008-03-18 23:24  Phillip Smith <phillip.smith@weatherbeeta.com.au>
  parent: Yusnel Rojas García <onemoverx@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Phillip Smith @ 2008-03-18 23:24 UTC (permalink / raw)
  To: pgsql-sql

> Is there any way to do what pg_dump does?, I mean, get the structure of a
table in a database (ex: CREATE TABLE ...)

Turn Query Logging on in postgresql.conf then see what queries are executed
by pgAdmin or similar when you run it?


THINK BEFORE YOU PRINT - Save paper if you don't really need to print this

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump using SQL
@ 2008-03-19 03:01  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Phillip Smith <phillip.smith@weatherbeeta.com.au>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2008-03-19 03:01 UTC (permalink / raw)
  To: Phillip Smith <phillip.smith@weatherbeeta.com.au>; +Cc: pgsql-sql

"Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
>> Is there any way to do what pg_dump does?, I mean, get the structure of a
>> table in a database (ex: CREATE TABLE ...)

> Turn Query Logging on in postgresql.conf then see what queries are executed
> by pgAdmin or similar when you run it?

But note that these queries are moving targets: they frequently change
from one PG version to the next.

By far the best answer, if you can use it, is to invoke pg_dump itself
as a subprocess.  Something like "pg_dump -s -t mytable ..." for
instance.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump using SQL
@ 2008-03-19 20:24  Preston Landers <planders@journyx.com>
  parent: Yusnel Rojas García <onemoverx@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Preston Landers @ 2008-03-19 20:24 UTC (permalink / raw)
  To: Yusnel Rojas Garc?a <onemoverx@gmail.com>; +Cc: pgsql-sql

Yusnel Rojas Garc?a(onemoverx@gmail.com)@2008.03.18 11:45:03 -0800:
> Hi everyone
> 
> Is there any way to do what pg_dump does?, I mean, get the structure of a
> table in a database (ex: CREATE TABLE ...)
> 

If you want to programmaticly discover the elements in a database
schema then you can always query the INFORMATION_SCHEMA:

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

That isn't the same as having the raw DLL statements that created
them, but depending on your purpose may be good enough.

regards,
Preston



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2008-03-19 20:24 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-18 19:45 pg_dump using SQL Yusnel Rojas García <onemoverx@gmail.com>
2008-03-18 23:24 ` Phillip Smith <phillip.smith@weatherbeeta.com.au>
2008-03-19 03:01   ` Tom Lane <tgl@sss.pgh.pa.us>
2008-03-19 20:24 ` Preston Landers <planders@journyx.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox