Thread: function to display ddl
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Hi,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Is there a PG command or fuction that will return table ddl?</span></font><p class="MsoNormal"><font face="Arial"size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Thanks</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><strong><b><font face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial">Doug Little</span></font></b></strong><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Sr. Data Warehouse Architect | Enterprise Data Management | Orbitz Worldwide </span></font><p class="MsoNormal"style="margin-right:-1.25in"><font face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial">500W. Madison, Suite 1000 Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164| Cell 847-997-5741</span></font><h3 style="margin:0in;margin-bottom:.0001pt"><strong><b><font face="Arial" size="2"><spanstyle="font-size:10.0pt;font-family:Arial;font-weight:normal"><a href="mailto:Douglas.Little@orbitz.com" title="mailto:dlittle@orbitz.com"><b><span style="font-weight:bold">Douglas.Little@orbitz.com</span></b></a></span></font></b></strong><span class="MsoHyperlink"><u><fontcolor="blue"></font></u></span></h3><p><font face="Times New Roman" size="3"><span style="font-size:12.0pt"> <imgborder="0" height="61" id="_x0000_i1025" src="cid:image001.jpg@01CAAD58.A438BEB0" width="83"/> <a href="http://www.orbitz.com/" title="http://www.orbitz.com/"><font face="Arial" size="1"><span style="font-size: 8.0pt;font-family:Arial"><span title="http://www.orbitz.com/">orbitz.com</span></span></font></a> <font color="blue"><spanstyle="color:blue">|</span></font> <a href="http://www.ebookers.com/" title="http://www.ebookers.com/"><fontface="Arial" size="1"><span style="font-size:8.0pt;font-family:Arial"><span title="http://www.ebookers.com/">ebookers.com</span></span></font></a><font color="blue"><span style="color:blue">|</span></font><a href="http://www.hotelclub.com/" title="http://www.hotelclub.com/"><font face="Arial"size="1"><span style="font-size:8.0pt;font-family:Arial"><span title="http://www.hotelclub.com/">hotelclub.com</span></span></font></a><font color="blue"><span style="color:blue">|</span></font><a href="http://www.cheaptickets.com/" title="http://www.cheaptickets.com/"><font face="Arial"size="1"><span style="font-size:8.0pt;font-family:Arial"><span title="http://www.cheaptickets.com/">cheaptickets.com</span></span></font></a><font color="blue"><span style="color:blue">|</span></font><a href="http://www.ratestogo.com/" title="http://www.ratestogo.com/"><font face="Arial"size="1"><span style="font-size:8.0pt;font-family:Arial"><span title="http://www.ratestogo.com/">ratestogo.com</span></span></font></a><fontcolor="blue"><span style="color:blue"> |</span></font><a href="http://www.asiahotels.com/" title="http://www.asiahotels.com/"><font face="Arial" size="1"><spanstyle="font-size:8.0pt;font-family:Arial"><span title="http://www.asiahotels.com/">asiahotels.com</span></span></font></a> </span></font><pclass="MsoNormal"><font face="TimesNew Roman" size="3"><span style="font-size: 12.0pt"> </span></font></div>
Little, Douglas wrote: > > Hi, > > > > Is there a PG command or fuction that will return table ddl? > If you just want the definition,in psql type \d tablename. To dump ddl the pg_dump with proper arguments can dump just the ddl of a single table. (see pg_dump --help) I'm not aware of a command or function that returns it though. Regards, Yeb Havinga
On Sun, Feb 14, 2010 at 05:08:05PM +0100, Yeb Havinga wrote: > Little, Douglas wrote: > > > >Hi, > > > > > > > >Is there a PG command or fuction that will return table ddl? > > > If you just want the definition,in psql type \d tablename. > To dump ddl the pg_dump with proper arguments can dump just the ddl of a > single table. (see pg_dump --help) more of a pg-users question, but since we've got a partial answer here, might as well complete it. Try psql -E, then \d sometable to see the commands psql issues to generate its display. Ross -- Ross Reedstrom, Ph.D. reedstrm@rice.edu Systems Engineer & Admin, Research Scientist phone: 713-348-6166 The Connexions Project http://cnx.org fax: 713-348-3665 Rice University MS-375, Houston, TX 77005 GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE