psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables

Поиск
Список
Период
Сортировка
От a.pervushina@postgrespro.ru
Тема psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables
Дата
Msg-id 191ef0d76e30a36f7d6326a3ce58bd0e@postgrespro.ru
обсуждение исходный текст
Ответы Re: psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables  (Anna Akenteva <a.akenteva@postgrespro.ru>)
Список pgsql-hackers
Hi,

I've attached a patch that implements \si, \sm, \st and \sr functions 
that show the CREATE command for indexes, matviews, triggers and tables. 
The functions are implemented similarly to the existing sf/sv functions 
with some modifications.

For triggers, I've decided to change input format to "table_name TRIGGER 
trigger_name", as multiple tables are allowed to have a trigger of the 
same name. Because we need to verify not only the name of the trigger, 
but also the name of the table, I've implemented a separate function 
lookup_trigger_oid that takes an additional argument.

Triggers and indexes use pg_catalog.pg_get_triggerdef() and 
pg_indexes.indexdef, while tables and matviews have separate queries for 
reconstruction. Get_create_object_cmd also runs three additional queries 
for tables, to get information on constraints, parents and columns.

There is also the question, if this functionality should be realised on 
the server instead of the client, but some people may think that changes 
to the language are "not the postgres way". However, server realisation 
may have some advantages, such as independence from the client and 
server version.

Best regards,
Alexandra Pervushina.

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: 13dev failed assert: comparetup_index_btree(): ItemPointer values should never be equal
Следующее
От: Josef Šimánek
Дата:
Сообщение: Re: [PATCH] Initial progress reporting for COPY command