Re: Question on INSERT statement - Mailing list pgsql-general

From Tom Lane
Subject Re: Question on INSERT statement
Date
Msg-id 16738.1090244762@sss.pgh.pa.us
Whole thread Raw
In response to Question on INSERT statement  (Geoffrey KRETZ <gk@4js.com>)
List pgsql-general
Geoffrey KRETZ <gk@4js.com> writes:
> I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
> the following request :
> INSERT INTO temp_tab VALUES (1,2,3)
> It  will insert the values in the three first row whereas with informix
> or db2 for exemple, it will return an error.

This is an extension to the spec - per SQL92 it would be right to throw
an error.  However Postgres has always behaved this way and we're not
likely to change it.  (I think it's a hangover from PostQUEL.)  Many
people find it to be a convenient behavior.

If you want an error then specify an explicit column list:

    INSERT INTO temp_tab (f1,f2,f3,f4,f5) VALUES (1,2,3)

            regards, tom lane

pgsql-general by date:

Previous
From: "raptor@tvskat.net"
Date:
Subject: enumerated type..
Next
From: Franco Bruno Borghesi
Date:
Subject: Re: enumerated type..