From: | Neil Conway <nconway(at)klamath(dot)dyndns(dot)org> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | insert with multiple targetLists |
Date: | 2002-05-01 23:16:56 |
Message-ID: | 20020501191656.3b2d651b.nconway@klamath.dyndns.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
I've been taking a look at fixing the TODO item:
o Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
My first plan of attack was to replace the current list of ResTargets
in InsertStmt with a list of lists. The problem with that approach is
that:
(a) the InsertStmt is converted to a Query. I could also change Query
to use a list of lists (instead of a list) for holding TargetEntry
items, but that would be ugly (since Query is generic, and this
would only be needed for Inserts)
(b) modifying Query would mean a lot of work (e.g. in the rewriter),
adapting all the places that expect targetList to be a list to
instead use a list of lists. Once again, this would be messy.
So, that seems like a bad idea.
ISTM that a better way to do this would be to parse the InsertStmt,
and then execute an INSERT for every targetList in the query.
For example:
INSERT INTO t1 (c1) VALUES (1), (2);
would be executed in a similar fashion to:
INSERT INTO t1 (c1) VALUES (1);
INSERT INTO t1 (c1) VALUES (2);
Does this sound reasonable?
Any suggestions would be welcome.
Cheers,
Neil
--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC
From | Date | Subject | |
---|---|---|---|
Next Message | cbbrowne | 2002-05-01 23:25:12 | Re: PostgreSQL mission statement? |
Previous Message | cbbrowne | 2002-05-01 23:08:28 | Re: mV database tools |