Re: find the template of a database in SQL - Mailing list pgsql-hackers

From korryd@enterprisedb.com
Subject Re: find the template of a database in SQL
Date
Msg-id 1155918967.7217.318.camel@sakai.localdomain
Whole thread Raw
In response to Re: find the template of a database in SQL  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
<blockquote type="CITE"><pre>
<font color="#000000">> When I have a table that I don't know if it inherits from template 1,</font>
<font color="#000000">> how can I find the 'super' ?</font>
<font color="#000000">I do not believe that tables have templates in 7.4 unless you specifically</font>
<font color="#000000">use a query like:</font>

<font color="#000000">create table foo as select * from bar;</font>

</pre></blockquote><br /> I think Walter wants to know if a given table was defined in the current database, or if it
wascreated from the template database (template0 or template1) when the database was created.<br /><br /> I don't think
youcan tell.  When you create a new database from a template (typically template1), you're just making a copy of that
template. It's not really inheritance (meaning that a change to the table definition in the template won't affect any
databases"cloned" from that template).<br /><br /> To find out where the table came from, you'd have to know which
templateyour current database was cloned from and I don't think we store that info anywhere.<br /><br />         --
Korry<br/><br /><table cellpadding="0" cellspacing="0" width="100%"><tr><td><br /><br /> --<br />   Korry Douglas    <a
href="mailto:korryd@enterprisedb.com">korryd@enterprisedb.com</a><br/>   EnterpriseDB      <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a></td></tr></table>

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: find the template of a database in SQL
Next
From: Naz Gassiep
Date:
Subject: pg_dump schema breakup