Re: BUG #16158: Check constraints using SQL functions work incorrectly

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pjander2(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16158: Check constraints using SQL functions work incorrectly
Date: 2019-12-10 15:00:24
Message-ID: CAKFQuwZHK-JV3_i-jyO_13VvOymqJhmT6XBnfgqepjSX+gNJ-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Dec 10, 2019 at 5:28 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 16158
> Logged by: Piotr Jander
> Email address: pjander2(at)gmail(dot)com
> PostgreSQL version: 11.5
> Operating system: x86_64 GNU/Linux
> Description:
>
> [...]

>
> My conjecture is that the bug is due to the use of SQL functions in the
> check.
> However, the
> [docs](https://www.postgresql.org/docs/9.4/ddl-constraints.html)
> on constraints do not mention any limitations on using such SQL functions
> in
> checks. If such limitations exist, they should be mentioned in the docs.
>

You should read the most current version of the documentation for a feature
before reporting a bug. In this case the warnings you desired have been
added to more recently versions of the documentation.

https://www.postgresql.org/docs/12/ddl-constraints.html

Short answer, check constraints are designed to work only with data present
on the table upon which they are defined. Use triggers to work with other
tables.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-12-10 15:14:31 Re: BUG #16158: Check constraints using SQL functions work incorrectly
Previous Message PG Bug reporting form 2019-12-10 12:27:13 BUG #16158: Check constraints using SQL functions work incorrectly