| From: | Thom Brown <thom(at)linux(dot)com> |
|---|---|
| To: | Vik Fearing <vik(at)postgresfriends(dot)org> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Logical Implication |
| Date: | 2026-09-11 14:41:54 |
| Message-ID: | CAA-aLv5r-3s4DWgSxfqmhmQsVASkj6VX2iJDDV3zNsnUCfrPgA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, 11 Sept 2026 at 14:36, Vik Fearing <vik(at)postgresfriends(dot)org> wrote:
>
> 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.
What behaviour should be expected for the following cases:
a IMPLIES b IMPLIES c
CHECK (a IMPLIES b) -- where b is NULL
-- And what does that deparse to?
a IMPLIES (100 / b > 10)
Thom
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yura Sokolov | 2026-09-11 14:43:22 | Re: convert various variables to atomics |
| Previous Message | Jeevan Chalke | 2026-09-11 14:36:46 | Re: postgres_fdw: push down FETCH FIRST .. WITH TIES when server version allows |