New CORRESPONDING clause design

From: Surafel Temsgen <surafel3000(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: New CORRESPONDING clause design
Date: 2017-01-17 06:37:43
Message-ID: CALAY4q8XqRqAaNsdC2Om+r8dNEgZbaBHTQYT+8DL0BCRdo7H0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

I am new here and I really want to contribute, I have read same resource
that help understanding database system and postgresql. I would like to
start implementing sql syntax corresponding by clause because I believe
implementing sql syntax gives an opportunity to familiarize many part of
postgresql source code. Previous implementation is here
<https://www.postgresql.org/message-id/CAJZSWkWN3YwQ01C3+cq0+eyZ1DmK=69_6vryrsVGMC=+fWrSZA@mail.gmail.com>and
have an issue on explain query and break cases on unlabeled NULLs
To repeat what a corresponding by clause means
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 SELECT 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) SELECT 4 b, 5 d, 6 c, 7 f;

with output:

b
--
2
4
My design is
*In parsing stage*
1. Check at least one common column name appear in queries
2. If corresponding column list is not specified, then make corresponding
list from common column name in queries target lists in the order
that those column names appear in first query
3. If corresponding column list is specified, then check that every column
name
in The corresponding column list appears in column names of both queries
*In planner*
1. Take projection columen name from corresponding list
2. Reorder left and right queries target lists according to corresponding
list
3. For each query, project columens as many as number of corresponding
columen.
Continue with normal set operation process

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-01-17 06:38:50 Re: Supporting huge pages on Windows
Previous Message Michael Paquier 2017-01-17 06:24:21 Re: pg_hba_file_settings view patch