pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how do I get table DDL from psql (not from pg_dump)
4+ messages / 4 participants
[nested] [flat]

* how do I get table DDL from psql (not from pg_dump)
@ 2008-02-27 11:22 Sofer, Yuval <Yuval_Sofer@bmc.com>
  2008-02-27 12:19 ` Re: how do I get table DDL from psql (not from pg_dump) A. Kretschmer <andreas.kretschmer@schollglas.com>
  2008-02-27 15:23 ` Re: how do I get table DDL from psql (not from pg_dump) Frank Bax <fbax@sympatico.ca>
  0 siblings, 2 replies; 4+ messages in thread

From: Sofer, Yuval @ 2008-02-27 11:22 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Abraham, Danny <danny_abraham@bmc.com>; Amichay, Nathan <Nathan_Amichay@bmc.com>

Hi 

 

I need to extract table DDL (create script) from database connection
(using sql, by retrieving system table info or by activating some pg
function)

 

Is this possible in postgres? 

 

Please help

 

Thanks 

 

Yuval Sofer
BMC Software
CTM&D Business Unit

DBA Team
972-52-4286-282
yuval_sofer@bmc.com

 

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

* Re: how do I get table DDL from psql (not from pg_dump)
  2008-02-27 11:22 how do I get table DDL from psql (not from pg_dump) Sofer, Yuval <Yuval_Sofer@bmc.com>
@ 2008-02-27 12:19 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
  2008-02-27 16:57   ` Re: how do I get table DDL from psql (not from pg_dump) Lew <lew@lwsc.ehost-services.com>
  1 sibling, 1 reply; 4+ messages in thread

From: A. Kretschmer @ 2008-02-27 12:19 UTC (permalink / raw)
  To: pgsql-sql

am  Wed, dem 27.02.2008, um  5:22:33 -0600 mailte Sofer, Yuval folgendes:
> Hi
> 
>  
> 
> I need to extract table DDL (create script) from database connection (using
> sql, by retrieving system table info or by activating some pg function)
> 
>  
> 
> Is this possible in postgres?

Why not using pg_dump?

You can specify with -n and -t an arbitrary table and with -s you get
only the DDL, not the data.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



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

* Re: how do I get table DDL from psql (not from pg_dump)
  2008-02-27 11:22 how do I get table DDL from psql (not from pg_dump) Sofer, Yuval <Yuval_Sofer@bmc.com>
  2008-02-27 12:19 ` Re: how do I get table DDL from psql (not from pg_dump) A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2008-02-27 16:57   ` Lew <lew@lwsc.ehost-services.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Lew @ 2008-02-27 16:57 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org.pgsql-sql

A. Kretschmer wrote:
> am  Wed, dem 27.02.2008, um  5:22:33 -0600 mailte Sofer, Yuval folgendes:
>> Hi
>>
>>  
>>
>> I need to extract table DDL (create script) from database connection (using
>> sql, by retrieving system table info or by activating some pg function)
>>
>>  
>>
>> Is this possible in postgres?
> 
> Why not using pg_dump?
> 
> You can specify with -n and -t an arbitrary table and with -s you get
> only the DDL, not the data.

The "-s" option has come up as an answer to both multi-posted instances of 
this question.

-- 
Lew



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

* Re: how do I get table DDL from psql (not from pg_dump)
  2008-02-27 11:22 how do I get table DDL from psql (not from pg_dump) Sofer, Yuval <Yuval_Sofer@bmc.com>
@ 2008-02-27 15:23 ` Frank Bax <fbax@sympatico.ca>
  1 sibling, 0 replies; 4+ messages in thread

From: Frank Bax @ 2008-02-27 15:23 UTC (permalink / raw)
  To: pgsql-sql

Sofer, Yuval wrote:
> I need to extract table DDL (create script) from database connection 
> (using sql, by retrieving system table info or by activating some pg 
> function)


This command should output the SQL you need...

echo '\d tablename' | psql -E





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


end of thread, other threads:[~2008-02-27 16:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27 11:22 how do I get table DDL from psql (not from pg_dump) Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-02-27 12:19 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2008-02-27 16:57   ` Lew <lew@lwsc.ehost-services.com>
2008-02-27 15:23 ` Frank Bax <fbax@sympatico.ca>

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