Re: Enforce primary key on every table during dev?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Enforce primary key on every table during dev?
Date: 2018-02-28 14:14:32
Message-ID: CAKFQuwYHAcVUkZtEpMfvHaEjv8fN418FBVizGNwgRir4n+X3tQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 28, 2018 at 6:34 AM, Jeremy Finzel <finzelj(at)gmail(dot)com> wrote:

> 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:
>

​Add a query to your test suite that queries the catalogs and fails if this
policy is violated. There is nothing in a running PostgreSQL server
instance that is going to enforce this for you.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Phil Florent 2018-02-28 16:50:44 Parallel index creation & pg_stat_activity
Previous Message John McKown 2018-02-28 14:03:21 Re: Enforce primary key on every table during dev?