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 <[EMAIL PROTECTED]>
PGP Key ID: DB3C29FC

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to