Search Postgresql Archives

Re: forcing a table (parent in inheritance) tor emain empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 11, 2016 at 12:27 PM, Rémi Cura <remi.cura@xxxxxxxxx> wrote:
> Hey dear list,
> I can't find a nice solution to enforce a necessary behaviour in my case :
> I want a parent table to remain empty.
>
> Of course I could define a trigger and return NULL in any case, but I'd like
> a more elegant approach using check or constraints.

You could probably do it with a simple constraint:

postgres=# create table dum(check (false));
CREATE TABLE
postgres=# insert into dum default values;
ERROR:  new row for relation "dum" violates check constraint "dum_check"
DETAIL:  Failing row contains ().


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux