Propose: enum with all registered table names?
| От | Dmitry Koterov |
|---|---|
| Тема | Propose: enum with all registered table names? |
| Дата | |
| Msg-id | d7df81620811200852r1c9c011bn7d25d28b9796408@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Propose: enum with all registered table names?
Re: Propose: enum with all registered table names? |
| Список | pgsql-general |
Hello.
Sometimes I want to save in a table reference to another table's name.
E.g. I am creating an accounting system which (on triggers) logs which record is changed and in which table:
CREATE TABLE log(
tbl XXX,
id INTEGER,
blahblah
);
Nowadays XXX may be:
1) Table name. But it is quite inefficient by disk usage. Another bad thing: if I rename a table, I have to rename all rows in log table.
2) Table OID. It is very bad for pg_dump: after the restoration log table will be unusable.
3) ENUM with all table names. But I have to add an element to ENUM each time I create a new table, and, if I rename a table, I have to rename an ENUM element too.
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.
Sometimes I want to save in a table reference to another table's name.
E.g. I am creating an accounting system which (on triggers) logs which record is changed and in which table:
CREATE TABLE log(
tbl XXX,
id INTEGER,
blahblah
);
Nowadays XXX may be:
1) Table name. But it is quite inefficient by disk usage. Another bad thing: if I rename a table, I have to rename all rows in log table.
2) Table OID. It is very bad for pg_dump: after the restoration log table will be unusable.
3) ENUM with all table names. But I have to add an element to ENUM each time I create a new table, and, if I rename a table, I have to rename an ENUM element too.
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.
В списке pgsql-general по дате отправления: