Enforce primary key on every table during dev?

Поиск
Список
Период
Сортировка
От Jeremy Finzel
Тема Enforce primary key on every table during dev?
Дата
Msg-id CAMa1XUie6LD140KdMY7cst41uCaa5B1YEgJ3GH3XSgDh2WXguQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Enforce primary key on every table during dev?  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Re: Enforce primary key on every table during dev?  (John McKown <john.archie.mckown@gmail.com>)
Re: Enforce primary key on every table during dev?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Enforce primary key on every table during dev?  (Tim Cross <theophilusx@gmail.com>)
Список pgsql-general
We want to enforce a policy, partly just to protect those who might forget, for every table in a particular schema to have a primary key.  This can't be done with event triggers as far as I can see, because it is quite legitimate to do:

BEGIN;
CREATE TABLE foo (id int);
ALTER TABLE foo ADD PRIMARY KEY (id);
COMMIT;

It would be nice to have some kind of "deferrable event trigger" or some way to enforce that no transaction commits which added a table without a primary key.

Any ideas?

Thanks,
Jeremy

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

Предыдущее
От: pkashimalla
Дата:
Сообщение: How to avoid trailing zero (after decimal point) for numeric typecolumn
Следующее
От: Achilleas Mantzios
Дата:
Сообщение: Re: Enforce primary key on every table during dev?