[HACKERS] New CORRESPONDING clause design - Mailing list pgsql-hackers

From Surafel Temsgen
Subject [HACKERS] New CORRESPONDING clause design
Date
Msg-id CALAY4q8XqRqAaNsdC2Om+r8dNEgZbaBHTQYT+8DL0BCRdo7H0w@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] New CORRESPONDING clause design  (Merlin Moncure <mmoncure@gmail.com>)
Re: [HACKERS] New CORRESPONDING clause design  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] New CORRESPONDING clause design  (Pavel Stehule <pavel.stehule@gmail.com>)
List 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 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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] pg_hba_file_settings view patch
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Supporting huge pages on Windows