Re: [HACKERS] Idea on how to simplify comparing two sets - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: [HACKERS] Idea on how to simplify comparing two sets
Date
Msg-id CAASwCXdWON5udZ0x77Epn0Df5WfsCHBAUWAFALPO3hC0a21m=Q@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Idea on how to simplify comparing two sets  (David Fetter <david@fetter.org>)
List pgsql-hackers
On Tue, Feb 7, 2017 at 6:28 PM, David Fetter <david@fetter.org> wrote:
> This could be shortened further to the following if we ever implement
> DISTINCT for window functions, which might involve implementing
> DISTINCT via hashing more generally, which means hashable
> types...whee!
>
> SELECT array_agg(DISTINCT (a IS NOT NULL)::int + (b IS NOT NULL)::int) OVER () = '{2}'
> FROM a FULL JOIN b ON ...

That's still a lot more syntax than just adding "IS NOT DISTINCT FROM"
in between the sets.

I just thought the general approach at looking for ways to express new
things in SQL,
without introducing new keywords, but instead rely on existing keywords but
that currently are syntax errors when used in some semantic way,
is an interesting approach to allow extending the SQL syntax without
breaking backwards compatibility.

Are there any historical examples of when this approach has been used
to make progress in PostgreSQL?



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [HACKERS] Idea on how to simplify comparing two sets
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] Press Release Draft - 2016-02-09 Cumulative Update