(PATCH) Adding CORRESPONDING to Set Operations - Mailing list pgsql-hackers

From Kerem Kat
Subject (PATCH) Adding CORRESPONDING to Set Operations
Date
Msg-id CAJZSWkWN3YwQ01C3+cq0+eyZ1DmK=69_6vryrsVGMC=+fWrSZA@mail.gmail.com
Whole thread Raw
Responses Re: (PATCH) Adding CORRESPONDING to Set Operations  ("Erik Rijkers" <er@xs4all.nl>)
List pgsql-hackers
Adding CORRESPONDING to Set Operations
Initial patch, filename: corresponding_clause_v2.patch

This patch adds CORRESPONDING clause to set operations according to
SQL20nn standard draft as Feature F301, "CORRESPONDING in query
expressions"

Corresponding clause either contains a BY(...) clause or not. If it
doesn't have a BY(...) clause the usage is as follows.

SELECT 1 a, 2 b, 3 c UNION CORRESPONDING 4 b, 5 d, 6 c, 7 f;

with output:
b c
-----
2 3
4 6

i.e. matching column names are filtered and are only output from the
whole set operation clause.

If we introduce a BY(...) clause, then column names are further
intersected with that BY clause:

SELECT 1 a, 2 b, 3 c UNION CORRESPONDING BY(b) 4 b, 5 d, 6 c, 7 f;

with output:

b
--
2
4

This patch compiles and tests successfully with master branch.

It has been tested only on Pardus Linux i686 ( Kernel 2.6.37.6 #1 SMP
i686 i686 i386 GNU/Linux)

This patch includes documentation and add one regression file.

This patch addresses the following TODO item:
SQL Commands: Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT


Best Regards,

Kerem KAT

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Separating bgwriter and checkpointer
Next
From: Fujii Masao
Date:
Subject: Re: Separating bgwriter and checkpointer