ADD CHECK fails for parent table if column used in CHECK is fully-qualified

From: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: ADD CHECK fails for parent table if column used in CHECK is fully-qualified
Date: 2019-07-24 10:00:11
Message-ID: CA+u7OA6Zs6bZmuakbLv4=7VBOYpBsyswpb7A3hN=n+KO0_z0pQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi everyone,

Consider the following case:

CREATE TABLE t0(c0 boolean);
CREATE TABLE t1(c0 boolean) INHERITS(t0);
ALTER TABLE t0 ADD CHECK(t0.c0); -- unexpected: ERROR: missing
FROM-clause entry for table "t0"

Is it expected that this fails? Without a child table, this works as I
would expect. If this is expected, I think that the error message
could be misleading. It seems that the full-qualified c0 column (i.e.,
t0.c0) triggers this, because the following works:

CREATE TABLE t0(c0 boolean);
CREATE TABLE t1(c0 boolean) INHERITS(t0);
ALTER TABLE t0 ADD CHECK(c0); -- no error

Best,
Manuel

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jatinder Sandhu 2019-07-24 14:40:31 Re: partition table slow planning
Previous Message Imre Samu 2019-07-24 09:16:05 Re: partition table slow planning