psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables
Вложения
В списке pgsql-hackers по дате отправления:
| От | 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
|
| Список | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера