Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-11-23 Thread Tom Lane
Dean Rasheed writes: > On Sun, 22 Nov 2020 at 20:58, Tom Lane wrote: >> However, I think that just adjusting the error string would be >> helpful, as attached. > +1 >> (I'm also wondering why the second case is generic ERRCODE_SYNTAX_ERROR >> and not ERRCODE_GENERATED_ALWAYS. Didn't change it

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-11-23 Thread Dean Rasheed
On Sun, 22 Nov 2020 at 20:58, Tom Lane wrote: > > I found only one nitpicky bug: in > findDefaultOnlyColumns, the test must be bms_is_empty(default_only_cols) > not just default_only_cols == NULL, or it will fail to fall out early > as intended when the first row contains some DEFAULTs but later r

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-11-22 Thread Tom Lane
Dean Rasheed writes: > I think it's actually easier to just do it all in the rewriter -- at > the point where we see that we're about to insert potentially illegal > values from a VALUES RTE into a generated column, scan it to see if > all the values in that column are DEFAULTs, and if so trigger

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-11-20 Thread Dean Rasheed
On Sun, 6 Sept 2020 at 22:42, Tom Lane wrote: > > I think you'd be better off to make transformInsertStmt(), specifically > its multi-VALUES-rows code path, check for all-DEFAULT columns and adjust > the tlist itself. Doing it there might be a good bit less inefficient > for very long VALUES list

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-09-06 Thread Tom Lane
Mikhail Titov writes: > Previously submitted patch got somehow trailing spaces mangled on the > way out. This is an attempt to use application/octet-stream MIME instead > of text/x-patch to preserve those for regression tests. I took a quick look through this. I agree with the general idea of de

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-08-14 Thread Mikhail Titov
Previously submitted patch got somehow trailing spaces mangled on the way out. This is an attempt to use application/octet-stream MIME instead of text/x-patch to preserve those for regression tests. On Thu, Aug 13, 2020 at 12:11 AM, Pavel Stehule wrote: > please, assign your patch to commitfest a

Re: [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-08-12 Thread Pavel Stehule
Hi čt 13. 8. 2020 v 6:31 odesílatel Mikhail Titov napsal: > Hello! > > According to the docs[1], one may use DEFAULT keyword while inserting > into generated columns (stored and identity). However, currently it > works only for a single VALUES sublist with DEFAULT for a generated column > but no

[bug+patch] Inserting DEFAULT into generated columns from VALUES RTE

2020-08-12 Thread Mikhail Titov
Hello! According to the docs[1], one may use DEFAULT keyword while inserting into generated columns (stored and identity). However, currently it works only for a single VALUES sublist with DEFAULT for a generated column but not for the case when VALUES RTE is used. This is not being tested and it