pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15055: parenthesis disappear
2+ messages / 2 participants
[nested] [flat]
* BUG #15055: parenthesis disappear
@ 2018-02-07 16:04 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2018-02-07 16:04 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: andrei@ivc.com
The following bug has been logged on the website:
Bug reference: 15055
Logged by: Andrei Mitran
Email address: andrei@ivc.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?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15055: parenthesis disappear
@ 2018-02-07 16:14 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2018-02-07 16:14 UTC (permalink / raw)
To: andrei@ivc.com; pgsql-bugs@lists.postgresql.org
On Wed, Feb 7, 2018 at 9:04 AM, PG Bug reporting form <
noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 15055
> Logged by: Andrei Mitran
> Email address: andrei@ivc.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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-02-07 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 16:04 BUG #15055: parenthesis disappear PG Bug reporting form <noreply@postgresql.org>
2018-02-07 16:14 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox