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.
Hum, it's been so long, I totally forgot. Which makes me wonder why the parser doesn't "know" that a default of NULL for a primary key is going to fail anyway and flag it at CREATE time. Oh, well. Thanks.
primary key. Of course, you could amend the policy to say a "non-NULL primary key".
-- I have a theory that it's impossible to prove anything, but I can't prove it.