Search Postgresql Archives

Re: Propose: enum with all registered table names?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux