Re: Idea on how to simplify comparing two sets

From: Joel Jacobson <joel(at)trustly(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Idea on how to simplify comparing two sets
Date: 2017-02-07 17:33:41
Message-ID: CAASwCXdWON5udZ0x77Epn0Df5WfsCHBAUWAFALPO3hC0a21m=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 7, 2017 at 6:28 PM, David Fetter <david(at)fetter(dot)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?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-02-07 17:36:52 Re: Press Release Draft - 2016-02-09 Cumulative Update
Previous Message David Fetter 2017-02-07 17:28:19 Re: Idea on how to simplify comparing two sets