Re: [HACKERS] New CORRESPONDING clause design

2017-04-04 Thread David Steele
On 4/1/17 1:54 PM, Tom Lane wrote: > > I'll set this back to Waiting on Author, but I think the chances of > getting to a committable patch before the end of the commitfest are > about nil. I think this is especially true now that another three days have passed. This submission has been marked "

Re: [HACKERS] New CORRESPONDING clause design

2017-04-01 Thread Tom Lane
Pavel Stehule writes: > [ corresponding_clause_v12.patch ] I worked on this for awhile but eventually decided that it's not very close to being committable. The main thing that's scaring me off is a realization that there are a *lot* of places that assume that the output columns of a set operati

Re: [HACKERS] New CORRESPONDING clause design

2017-03-30 Thread Pavel Stehule
Hi 2017-03-30 21:55 GMT+02:00 Pavel Stehule : > > > 2017-03-30 21:43 GMT+02:00 Tom Lane : > >> Pavel Stehule writes: >> > Is following use case defined in standard? >> >> > postgres=# SELECT 0 AS x1, 1 AS a, 0 AS x2, 2 AS b, 0 AS x3, -1 AS x3 >> >UNION ALL CORRESPONDING BY(a,b) SELEC

Re: [HACKERS] New CORRESPONDING clause design

2017-03-30 Thread Pavel Stehule
2017-03-30 21:43 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > Is following use case defined in standard? > > > postgres=# SELECT 0 AS x1, 1 AS a, 0 AS x2, 2 AS b, 0 AS x3, -1 AS x3 > >UNION ALL CORRESPONDING BY(a,b) SELECT 4 AS b, 0 AS x4, 3 AS > a, > > 0 AS x6, -1 AS x6 > >

Re: [HACKERS] New CORRESPONDING clause design

2017-03-30 Thread Tom Lane
Pavel Stehule writes: > Is following use case defined in standard? > postgres=# SELECT 0 AS x1, 1 AS a, 0 AS x2, 2 AS b, 0 AS x3, -1 AS x3 >UNION ALL CORRESPONDING BY(a,b) SELECT 4 AS b, 0 AS x4, 3 AS a, > 0 AS x6, -1 AS x6 >UNION ALL CORRESPONDING SELECT 0 AS x8, 6 AS a,

Re: [HACKERS] New CORRESPONDING clause design

2017-03-30 Thread Pavel Stehule
Hi 2017-03-30 13:11 GMT+02:00 Surafel Temesgen : > hi > > Thank you very much for your help . > here is the patch fix that issue as you suggest > The crash is fixed I did a rebase + few more regress tests. Is following use case defined in standard? postgres=# SELECT 0 AS x1, 1 AS a, 0 AS x2,

Re: [HACKERS] New CORRESPONDING clause design

2017-03-30 Thread Surafel Temesgen
hi Thank you very much for your help . here is the patch fix that issue as you suggest Regards Surafel On Tue, Mar 28, 2017 at 5:44 PM, Pavel Stehule wrote: > > > 2017-03-28 14:18 GMT+02:00 Pavel Stehule : > >> >> >> 2017-03-28 13:58 GMT+02:00 Surafel Temesgen : >> >>> can you help with fixi

Re: [HACKERS] New CORRESPONDING clause design

2017-03-28 Thread Pavel Stehule
2017-03-28 14:18 GMT+02:00 Pavel Stehule : > > > 2017-03-28 13:58 GMT+02:00 Surafel Temesgen : > >> can you help with fixing it Pavel? >> > > There must be some new preanalyze stage - you have to know result columns > before you are starting a analyze > maybe some recheck after analyze stage to r

Re: [HACKERS] New CORRESPONDING clause design

2017-03-28 Thread Pavel Stehule
2017-03-28 13:58 GMT+02:00 Surafel Temesgen : > can you help with fixing it Pavel? > There must be some new preanalyze stage - you have to know result columns before you are starting a analyze Regards Pavel > > On Mon, Mar 27, 2017 at 11:48 AM, Pavel Stehule > wrote: > >> Hi >> >> fresh updat

Re: [HACKERS] New CORRESPONDING clause design

2017-03-28 Thread Surafel Temesgen
can you help with fixing it Pavel? On Mon, Mar 27, 2017 at 11:48 AM, Pavel Stehule wrote: > Hi > > fresh update - I enhanced Value node by location field as Tom proposal. > > Few more regress tests. > > But I found significant issue, that needs bigger fix - Surafel, please, > can you fix it. > >

Re: [HACKERS] New CORRESPONDING clause design

2017-03-27 Thread Pavel Stehule
Hi fresh update - I enhanced Value node by location field as Tom proposal. Few more regress tests. But I found significant issue, that needs bigger fix - Surafel, please, can you fix it. It crash on SELECT 0 AS x1, 1 AS a, 0 AS x2, 2 AS b, 0 AS x3, -1 AS x3 UNION ALL CORRESPONDING SELECT 4 AS

Re: [HACKERS] New CORRESPONDING clause design

2017-03-26 Thread Pavel Stehule
Hi 2017-03-25 13:41 GMT+01:00 Surafel Temesgen : > > >> >> I took a quick look through this and noted that it fails to touch >> ruleutils.c, which means that dumping of views containing CORRESPONDING >> certainly doesn't work. >> > fixed > >> Also, the changes in parser/analyze.c seem rather mass

Re: [HACKERS] New CORRESPONDING clause design

2017-03-25 Thread Surafel Temesgen
> > > I took a quick look through this and noted that it fails to touch > ruleutils.c, which means that dumping of views containing CORRESPONDING > certainly doesn't work. > fixed > Also, the changes in parser/analyze.c seem rather massive and > correspondingly hard to review. Is it possible to r

Re: [HACKERS] New CORRESPONDING clause design

2017-03-22 Thread Surafel Temesgen
On Sat, Mar 18, 2017 at 7:50 PM, Tom Lane wrote: > Pavel Stehule writes: > > I have not any objection - I'll mark this patch as ready for commiter > > > I'm a little disturbed by the fact that determineMatchingColumns() > is called twice, and more disturbed by the fact that it looks to be > O(N^

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Pavel Stehule
2017-03-18 19:12 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > 2017-03-18 18:32 GMT+01:00 Tom Lane : > >> I definitely don't see a reason for CORRESPONDING to track locations of > >> name list elements when no other name list productions do. It might be > >> worth proposing a followon patch t

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Tom Lane
Pavel Stehule writes: > 2017-03-18 18:32 GMT+01:00 Tom Lane : >> I definitely don't see a reason for CORRESPONDING to track locations of >> name list elements when no other name list productions do. It might be >> worth proposing a followon patch to change all of them (perhaps by adding >> a loca

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Pavel Stehule
2017-03-18 18:32 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > 2017-03-18 17:50 GMT+01:00 Tom Lane : > >> I'm not impressed by using A_Const for the members of the CORRESPONDING > >> name list. That's not a clever solution, that's a confusing kluge, > >> because it's a complete violation of t

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Tom Lane
Pavel Stehule writes: > 2017-03-18 17:50 GMT+01:00 Tom Lane : >> I'm not impressed by using A_Const for the members of the CORRESPONDING >> name list. That's not a clever solution, that's a confusing kluge, >> because it's a complete violation of the meaning of A_Const. Elsewhere >> we just use

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Pavel Stehule
2017-03-18 17:50 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > I have not any objection - I'll mark this patch as ready for commiter > > I took a quick look through this and noted that it fails to touch > ruleutils.c, which means that dumping of views containing CORRESPONDING > certainly doesn

Re: [HACKERS] New CORRESPONDING clause design

2017-03-18 Thread Tom Lane
Pavel Stehule writes: > I have not any objection - I'll mark this patch as ready for commiter I took a quick look through this and noted that it fails to touch ruleutils.c, which means that dumping of views containing CORRESPONDING certainly doesn't work. Also, the changes in parser/analyze.c se

Re: [HACKERS] New CORRESPONDING clause design

2017-03-15 Thread Pavel Stehule
Hi 2017-03-14 16:33 GMT+01:00 Surafel Temesgen : > > hi > > Some errors are related to just CORRESPONDING without any columns. So >> using expr doesn't help here. So parse node CORRESPONDING can solve both >> issues. >> > In current implementation pointing to a node means pointing to a node’s >

Re: [HACKERS] New CORRESPONDING clause design

2017-03-14 Thread Surafel Temesgen
hi Some errors are related to just CORRESPONDING without any columns. So using > expr doesn't help here. So parse node CORRESPONDING can solve both issues. > > In current implementation pointing to a node means pointing to a node’s first element so I don’t think we can be able to point to CORRESP

Re: [HACKERS] New CORRESPONDING clause design

2017-03-13 Thread Pavel Stehule
2017-03-13 14:13 GMT+01:00 Surafel Temesgen : > > > On Sat, Mar 11, 2017 at 9:01 AM, Pavel Stehule > wrote: > > >> I am sending minor update - cleaning formatting and white spaces, error >> messages + few more tests >> > > Thank you very much for your help > > >> Maybe correspondingClause needs o

Re: [HACKERS] New CORRESPONDING clause design

2017-03-13 Thread Surafel Temesgen
On Sat, Mar 11, 2017 at 9:01 AM, Pavel Stehule wrote: > I am sending minor update - cleaning formatting and white spaces, error > messages + few more tests > Thank you very much for your help > Maybe correspondingClause needs own node type with attached location. Then > context can be much be

Re: [HACKERS] New CORRESPONDING clause design

2017-03-10 Thread Pavel Stehule
Hi 2017-03-10 13:49 GMT+01:00 Pavel Stehule : > Hi > > 2017-03-10 12:55 GMT+01:00 Pavel Stehule : > >> >> >> 2017-03-10 10:13 GMT+01:00 Surafel Temesgen : >> >>> Yes, you are correct it should to work on CORRESPONDING clause case. SQL >>> 20nn standard draft only said each query to be of the same

Re: [HACKERS] New CORRESPONDING clause design

2017-03-10 Thread Pavel Stehule
Hi 2017-03-10 12:55 GMT+01:00 Pavel Stehule : > > > 2017-03-10 10:13 GMT+01:00 Surafel Temesgen : > >> Yes, you are correct it should to work on CORRESPONDING clause case. SQL >> 20nn standard draft only said each query to be of the same degree in a case >> of set operation without corresponding

Re: [HACKERS] New CORRESPONDING clause design

2017-03-10 Thread Pavel Stehule
2017-03-10 10:13 GMT+01:00 Surafel Temesgen : > Yes, you are correct it should to work on CORRESPONDING clause case. SQL > 20nn standard draft only said each query to be of the same degree in a case > of set operation without corresponding clause. The attached patch is > corrected as such .I add t

Re: [HACKERS] New CORRESPONDING clause design

2017-03-10 Thread Surafel Temesgen
Yes, you are correct it should to work on CORRESPONDING clause case. SQL 20nn standard draft only said each query to be of the same degree in a case of set operation without corresponding clause. The attached patch is corrected as such .I add those new test case to regression test too Regards S

Re: [HACKERS] New CORRESPONDING clause design

2017-03-09 Thread Pavel Stehule
hi 2017-03-09 17:19 GMT+01:00 Pavel Stehule : > > > 2017-03-09 13:18 GMT+01:00 Surafel Temesgen : > >> Hi , >> >> Here is a patch corrected as your feedback except missed tests case >> because corresponding by clause is implemented on the top of set operation >> and you can’t do that to set opera

Re: [HACKERS] New CORRESPONDING clause design

2017-03-09 Thread Pavel Stehule
2017-03-09 13:18 GMT+01:00 Surafel Temesgen : > Hi , > > Here is a patch corrected as your feedback except missed tests case > because corresponding by clause is implemented on the top of set operation > and you can’t do that to set operation without corresponding by clause too > I don't understa

Re: [HACKERS] New CORRESPONDING clause design

2017-03-09 Thread Surafel Temesgen
Hi , Here is a patch corrected as your feedback except missed tests case because corresponding by clause is implemented on the top of set operation and you can’t do that to set operation without corresponding by clause too Eg postgres=# SELECT 1 a, 2 b, 3 c UNION SELECT 4 a, 5 b, 6 c, 8 d; E

Re: [HACKERS] New CORRESPONDING clause design

2017-03-07 Thread Pavel Stehule
Hi I am sending a review of this interesting feature. I found following issues, questions: 1. unclosed tags in documentation 2. bad name "changeTargetEntry" - should be makeTargetEntry? 3. Why you removed lot of asserts in prepunion.c? These asserts should be valid still 4. make_coresponding_ta

Re: [HACKERS] New CORRESPONDING clause design

2017-02-19 Thread Robert Haas
On Thu, Feb 16, 2017 at 8:28 PM, Surafel Temsgen wrote: > Here is the implementation of the clause with the slight change, instead of > doing column mapping for each side of leaf Queries in planner I make the > projection nodes output to corresponding column lists only. > > This patch compiles and

Re: [HACKERS] New CORRESPONDING clause design

2017-02-16 Thread Surafel Temsgen
Here is the implementation of the clause with the slight change, instead of doing column mapping for each side of leaf Queries in planner I make the projection nodes output to corresponding column lists only. This patch compiles and tests successfully with master branch on ubuntu-15.10-desktop-amd

Re: [HACKERS] New CORRESPONDING clause design

2017-01-17 Thread Tom Lane
Surafel Temsgen writes: > 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 a

Re: [HACKERS] New CORRESPONDING clause design

2017-01-17 Thread David Fetter
On Tue, Jan 17, 2017 at 08:20:25AM -0600, Merlin Moncure wrote: > On Tue, Jan 17, 2017 at 12:37 AM, Surafel Temsgen > wrote: > > 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 implement

Re: [HACKERS] New CORRESPONDING clause design

2017-01-17 Thread Merlin Moncure
On Tue, Jan 17, 2017 at 12:37 AM, Surafel Temsgen wrote: > 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

[HACKERS] New CORRESPONDING clause design

2017-01-17 Thread Surafel Temsgen
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 postgres