Re: BUG #15055: parenthesis disappear

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: andrei(at)ivc(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15055: parenthesis disappear
Date: 2018-02-07 16:14:34
Message-ID: CAKFQuwYAh5KAmA_25HQWZz6T=DLCKhTXaRWz_6m4-5DCpcerNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Feb 7, 2018 at 9:04 AM, PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 15055
> Logged by: Andrei Mitran
> Email address: andrei(at)ivc(dot)com
> PostgreSQL version: 9.6.1
> Operating system: centos
> Description:
>
> alter table ivc.merit_matches
> add constraint priced_or_slotted_job
> check ((survey_code is null and slot_job_code is not null) or
> (slot_job_code is null and survey_code is not null));
> results in:
> Check constraints:
> "priced_or_slotted_job" CHECK (survey_code IS NULL AND slot_job_code IS
> NOT NULL OR slot_job_code IS NULL AND survey_code IS NOT NULL)
>
> What happened to my parens around the and conditions? I am not aware of any
> precedence of and over or - Am i misinformed?
>
>
​Yes, see:​


https://www.postgresql.org/docs/10/static/sql-syntax-lexical.html#SQL-PRECEDENCE

​AND > OR

The system parses inputs and stores them in object form in the catalogs -
then reconstructs a canonical representation when asked.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Kohn 2018-02-07 18:06:16 Re: BUG #15036: Un-killable queries Hanging in BgWorkerShutdown
Previous Message Peter Geoghegan 2018-02-07 16:05:07 Re: BUG #15053: SIGSEGV - While executing query with cube agregator