Logical Implication

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Logical Implication
Date: 2026-09-11 13:35:57
Message-ID: 37c76707-e6fa-4ee3-b57f-aa0bf1b0bba8@postgresfriends.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I would like to intruduce an IMPLIES operator for booleans that reads
better than its developed formula.  That is, I think

    a IMPLIES b

is better in CHECK constraints and elsewhere than

    NOT a OR b

.

I plan on submitting this to the SQL committee as well, but I've learned
that they like an implementation to have it first, and I cannot imagine
that they would quibble over the keyword used.

The first patch is a restructure of the documentation for NOT/AND/OR
because IMPLIES is not symmetric about the diagonal and I didn't want it
to stand out like a sore thumb. The second patch is the actual
implementation.

It does not survive a round trip which has precedence with IN being
changed to =ANY, BETWEEN changing to <= and >= (BETWEEN SYMMETRIC is
even worse), etc; so I don't think that is a problem.

Thanks,

--

Vik Fearing

PS: based off of c1c5d28f4a2

Attachment Content-Type Size
v1-0001-doc-Rearrange-the-logical-operator-truth-tables.patch text/plain 5.1 KB
v1-0002-Add-the-IMPLIES-boolean-operator.patch text/plain 23.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrizio Mello 2026-09-11 13:43:33 Re: Fix failing assert in deferred constraint trigger
Previous Message Noah Misch 2026-09-11 13:35:52 Re: pg_get_*_ddl() needs a redesign