Re: Propose: enum with all registered table names?

From: Richard Huxton <dev(at)archonet(dot)com>
To: dmitry(at)koterov(dot)ru
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Propose: enum with all registered table names?
Date: 2008-11-20 17:03:48
Message-ID: 49259874.6000800@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dmitry Koterov wrote:
>
> So it would be very useful if Postgres has a special, system ENUM (e.g.
> pg_catalog.table_names_enum) which holds names of all tables in the database
> (format: schema.table), and their elements are automatically renamed when a
> table is renamed.

Too late :-)

It's regclass you're after I think.

=> CREATE TABLE track_tables (t regclass);
=> INSERT INTO track_tables (t) VALUES ('"A"'::regclass);
INSERT 0 1
=> SELECT * FROM track_tables;
t
-----
"A"
(1 row)

=> ALTER TABLE "A" RENAME TO atable;
ALTER TABLE
=> SELECT * FROM track_tables;
t
--------
atable
(1 row)

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2008-11-20 17:07:46 Re: compiling libpq.dll with Borland C++, is it possible?
Previous Message Dmitry Koterov 2008-11-20 16:52:44 Propose: enum with all registered table names?