pg_get_tabledef - Mailing list pgsql-hackers

From Usama Munir
Subject pg_get_tabledef
Date
Msg-id 46519CB0.2080609@enterprisedb.com
Whole thread Raw
Responses Re: pg_get_tabledef  (Naz Gassiep <naz@mira.net>)
Re: pg_get_tabledef  (John DeSoi <desoi@pgedit.com>)
List pgsql-hackers
Hi, <br /><br /> i was following a thread some time ago where adding a function <b>pg_get_tabledef</b> was one of the
TODOsfor 8.2, but it somehow didn't make it to the release perhaps because the functionality was not clearly defined?
notsure.<br /><br /> Anyway  i happen to come up with a function for pg_get_tabledef which works something like
following<br/><br /><i>postgres=# select pg_get_tabledef(16388) ;<br />         pg_get_tabledef         <br />
--------------------------------<br/>  CREATE TABLE  public.dept<br />  (<br />   deptno numeric(2,0) NOT NULL,<br />  
dname character varying(14),<br />   loc    character varying(13)<br />  )<br />  WITHOUT OIDS;<br /></i>(1 row)<br
/><br/><br /><br /> i wanted to submit a patch for this, IFF the community wants this function. The rationale is
obviouslyto help Application developers writing applications like pgAdmin. Currently this part of SQL needs to be
constructedmanually for postgres by the tools.<br /><br /> it is arguable that a table defintion will have constraints
,triggers etc as well, and they can be added without much problem, but i think if a tool needs to construct an SQL for
alltable related objects then functions are already available for them like pg_get_constraintdef, pg_get_ruledef,
pg_get_indexdef,pg_get_triggerdef etc<br /><br /> i understand that you guys don't like someone to develop a patch in
isolationand just come up with it one day, but it really came out as a by-product of some other work , and i thought
youguys might be interested in it.<br /><br /> if it is desired,  i will submit  a patch for it, within a day or so.<br
/><br/> Regards,<br /> Usama Munir<br /> EnterpriseDB (<a class="moz-txt-link-abbreviated"
href="http://www.enterprisedb.com">www.enterprisedb.com</a>)<br/><br /><br /><br /> 

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: mb and ecpg regression tests
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: [Oledb-dev] double precision error with pg linux server, but not with windows pg server