Re: Question on INSERT statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Geoffrey KRETZ <gk(at)4js(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on INSERT statement
Date: 2004-07-19 13:46:02
Message-ID: 16738.1090244762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Geoffrey KRETZ <gk(at)4js(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Franco Bruno Borghesi 2004-07-19 13:53:45 Re: enumerated type..
Previous Message raptor@tvskat.net 2004-07-19 13:43:28 enumerated type..