Re: find the template of a database in SQL

From: "korryd(at)enterprisedb(dot)com" <korryd(at)enterprisedb(dot)com>
To: Walter Cruz <walter(dot)php(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: find the template of a database in SQL
Date: 2006-08-18 16:36:07
Message-ID: 1155918967.7217.318.camel@sakai.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > When I have a table that I don't know if it inherits from template 1,
> > how can I find the 'super' ?
> I do not believe that tables have templates in 7.4 unless you specifically
> use a query like:
>
> create table foo as select * from bar;
>

I think Walter wants to know if a given table was defined in the current
database, or if it was created from the template database (template0 or
template1) when the database was created.

I don't think you can 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).

To find out where the table came from, you'd have to know which template
your current database was cloned from and I don't think we store that
info anywhere.

-- Korry

--
Korry Douglas korryd(at)enterprisedb(dot)com
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-18 16:52:11 Re: pg_dump schema breakup
Previous Message Naz Gassiep 2006-08-18 16:28:51 pg_dump schema breakup