Re: pg and number of parameters by insert - Mailing list pgsql-general

From scott.marlowe
Subject Re: pg and number of parameters by insert
Date
Msg-id Pine.LNX.4.33.0212041418040.15383-100000@css120.ihs.com
Whole thread Raw
In response to Re: pg and number of parameters by insert  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
On Wed, 4 Dec 2002, Jean-Christian Imbeault wrote:

> pginfo wrote:
>  >
>  > No, it will help to correct many apps not to break.(Sorry).
>
> I mean it will break current applications that expect no error to be
> thrown if the wrong number of values are passed into an insert statement.
>
> Either way, I wonder what the SQL specs say about this.
>
> What do you say thos in the know, do the SQL specs have anything to say
> about what happens when an insert inserts less values than the total
> number of columns?
>
> I'm guessing it says that this is fine ... I would be very surprised if
> it said otherwise and Postgres wasn't up to spec on such a simple thing.
>
> So Ivan, if the specs specifically say that this condition is acceptable
> then there is nothing to be done I would think ...
>
> But maybe one of the developers can or someone who knows the specs can
> shed some light on this if you really want more info.
>
> Sorry I can't be of more help.

According to the strictest interpretation of the SQL92 standard, if the
<insert column list> is absent, it is assumed to be an implicit list of
all columns.  This subject came up a while ago on hackers.  It is my
understanding that most other databases behave the way postgresql does,
i.e. they do not assume ALL the columns are implicit, just enough to
correspond to the number of args in the values() part of the query.

If this were to be changed, it would likely be something that you'd have
to turn on explicitly with a GUC in the postgresql.conf file i.e.
strict_ansi_inserts = true or something like that.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Functions just dont want to work! [hard]
Next
From: Tom Lane
Date:
Subject: Re: Query breaking with unknown expression type (lost subquery from v iew?)