From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: INSERT and parentheses |
Date: | 2010-04-26 13:08:04 |
Message-ID: | g2n603c8f071004260608s83b07b23u56a1d5f3af3150e3@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Apr 26, 2010 at 8:57 AM, Marko Tiikkaja
<marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> wrote:
> Hi,
>
> This came up on IRC today and I recall several instances of this during
> the last two months or so, so I decided to send a patch. The problem in
> question occurs when you have extra parentheses in an INSERT list:
>
> INSERT INTO foo(a,b,c) SELECT (a,b,c) FROM ..; or
> INSERT INTO foo(a,b,c) VALUES((0,1,2));
>
> Both of these give you the same error:
> ERROR: INSERT has more target columns than expressions
>
> The first version is a lot more common and as it turns out, is sometimes
> very hard to spot. This patch attaches a HINT message to these two
> cases. The message itself could probably be a lot better, but I can't
> think of anything.
>
> Thoughts?
I suggest adding it to the next CommitFest. Since I've never been
bitten by this, I can't get excited about the change, but I'm also not
arrogant enough to believe that everyone else's experiences are the
same as my own.
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2010-04-26 13:13:54 | Re: INSERT and parentheses |
Previous Message | Robert Haas | 2010-04-26 13:03:14 | Re: recovery_connections cannot start (was Re: master in standby mode croaks) |