From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Patches (PostgreSQL) <pgsql-patches@postgresql.org>
Subject: Re: [HACKERS] 8.2 features?
Date: Mon, 31 Jul 2006 19:17:48 -0700
Message-ID: <44CEB9CC.2060102@joeconway.com> (raw)
In-Reply-To: <26167.1154395260@sss.pgh.pa.us>
References: <200607281947.k6SJlOI02533@momjian.us>
<473.1154116455@sss.pgh.pa.us>
<44CA76A9.8070101@joeconway.com>
<44CB051D.6090609@joeconway.com>
<21320.1154222840@sss.pgh.pa.us>
<26226.1154279741@sss.pgh.pa.us>
<44CE529F.2070701@joeconway.com>
<26167.1154395260@sss.pgh.pa.us>
Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>
>>I wanted to post an updated patch even though there are still things not
>>working again after conversion to bare expressions.
>
> I've been through the planner part of this and it looks OK (one or two
> small errors). I'm currently messing with a revised version of the
> grammar that supports putting VALUES everyplace that the spec allows,
> and is a bit simpler than the old one to boot: it folds VALUES and
> SELECT together, so we need fewer cases in the INSERT production.
> Of course this breaks most of what you did in the parser :-( ...
> I'm working on fixing that.
>
> I'm about to go out to dinner but thought I'd post the gram.y and
> parsenodes.h files so you could see where I'm headed. These are
> diffs from CVS tip, not from your patch.
>
Yup, I can see where you're headed. Looks nice!
In case you can make use of it, here's my latest. I found that I was
being too aggressive at freeing the input nodes to transformExpr() in
transformRangeValues() after using them. In many cases the returned node
is a new palloc'd node, but in some cases it is not.
The other issue I found was that I had neglected to fixup/coerce the raw
expressions ala updateTargetListEntry(). I ended up creating a somewhat
simpler updateValuesExprListEntry() to use on values expression lists.
I have yet to get to the similar/more general issue of coercing values
expression lists to common datatypes (i.e. using select_common_type()).
FWIW, here's a list of non-working cases at the moment:
8<-------------------------------------
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text
default 'testing');
--doesn't work
---------------
--wrong result
insert into inserttest (col2, col3) values (23, DEFAULT), (24, DEFAULT),
(25, 'hello'), (26, DEFAULT);
select * from (values (3,4),(2,3)) as t1(f1,f2) join (values
(3,8),(2,6)) as t2(f1,f2) using (f1);
select * from (values (3,4),(2,3)) as t1(f1,f2) join (values
(3,8),(2,6)) as t2(f1,f2) using (f1) where t2.f2 = 8;
select * from (values (3,4),(2,3)) as t1(f1,f2) join (values
(3,8),(2,6)) as t2(f1,f2) on t1.f1 = t2.f2 where t1.f1 = 3;
--corrupt result but no crash
select f1,f2 from (values (11,2),(26,'a'),(6,4)) as t(f1,f2) order by 1
desc;
--crash
select f1 from (values (1,2),(2,3)) as t(f1,f2) order by 1 desc;
select f1,f2 from (values (11,'a'),(26,13),(6,'c')) as t(f1,f2) order by
1 desc;
8<-------------------------------------
Joe
Attachments:
multi-insert-r19.diff.gz (application/x-gzip, 21.6K) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, pgsql-patches@postgresql.org
Subject: Re: [HACKERS] 8.2 features?
In-Reply-To: <44CEB9CC.2060102@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox