| От | Michael Fuhr |
|---|---|
| Тема | Re: How to detect primary key of a table |
| Дата | |
| Msg-id | 20060330114048.GA7391@winnie.fuhr.org обсуждение исходный текст |
| Ответ на | How to detect primary key of a table ("Sergey Karin" <sergey.karin@gmail.com>) |
| Список | pgsql-general |
On Thu, Mar 30, 2006 at 03:13:12PM +0400, Sergey Karin wrote: > Are there any abilities to detect primary key of a table? In psql you could use "\d tablename". To see the queries that psql makes, execute "\set ECHO_HIDDEN" and then "\d tablename". Here's the documentation for the system catalogs that psql queries: http://www.postgresql.org/docs/8.1/interactive/catalogs.html You could also query the Information Schema; table_constraints joined with key_column_usage or constraint_column_usage should yield a table's primary key columns. http://www.postgresql.org/docs/8.1/interactive/information-schema.html -- Michael Fuhr
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера