Re: query system tables to find columns unique constraint is constraining?
В списке pgsql-sql по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: query system tables to find columns unique constraint is constraining? |
| Дата | |
| Msg-id | 15686.1022613033@sss.pgh.pa.us обсуждение |
| Ответ на | query system tables to find columns unique constraint is constraining? ("Beth Gatewood" <beth@vizxlabs.com>) |
| Список | pgsql-sql |
"Beth Gatewood" <beth@vizxlabs.com> writes:
> I have been fiddling around trying to figure out which columns some unique
> constraints are constraining by querying the system tables.....with zero
> luck.
Look at the pg_index row for the index that's implementing the
constraint.
Rather than messing with the pg_index entry directly, you might want to
use pg_get_indexdef(), which is a helper function for pg_dump:
regression=# create table foo (f1 int, constraint foo_f1 unique (f1));
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'foo_f1' for table 'foo'
CREATE TABLE
regression=# select pg_get_indexdef(oid) from pg_class where relname = 'foo_f1'; pg_get_indexdef
----------------------------------------------------CREATE UNIQUE INDEX foo_f1 ON foo USING btree (f1)
(1 row)
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера