pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Re: how do I get table DDL from psql (not from pg_dump)
Date: Wed, 27 Feb 2008 10:23:28 -0500
Message-ID: <47C58070.2090809@sympatico.ca> (raw)
In-Reply-To: <BE67D1149BBD5746984545ED91F702E0BD4AE3@hou-ex-02.adprod.bmc.com>
References: <BE67D1149BBD5746984545ED91F702E0BD4AE3@hou-ex-02.adprod.bmc.com>

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





view thread (4+ messages)  latest in thread

Message-ID: <47C58070.2090809@sympatico.ca>
Permalink:  ../47C58070.2090809@sympatico.ca/
Also on:    postgresql.org/message-id/47C58070.2090809@sympatico.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fbax@sympatico.ca
  Subject: Re: how do I get table DDL from psql (not from pg_dump)
  In-Reply-To: <47C58070.2090809@sympatico.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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