Thread: Re: [PATCHES] ANSI Compliant Inserts

Re: [PATCHES] ANSI Compliant Inserts

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Rod Taylor writes:
> 
> > I submitted a patch which would make Postgresql ANSI compliant in
> > regards to INSERT with a provided column list.  As Tom states below,
> > this is not full compliance.
> >
> > CREATE TABLE tab(col1 text, col2 text);
> >
> > INSERT INTO tab (col1, col2) VALUES ('val1'); -- bad by spec (enforced
> > by patch)
> > INSERT INTO tab (col1, col2) VALUES ('val1', 'val2'); -- good
> >
> > INSERT INTO tab VALUES ('val1'); -- bad by spec (not enforced)
> > INSERT INTO tab VALUES ('val1', 'val2'); -- good
> 
> I recall that this was the behavior we agreed we wanted.  IMHO, it would
> be conditional on the INSERT ... VALUES (DEFAULT) capability being
> provided.  I'm not sure if that is there yet.

Yes, it is key to have DEFAULT working before we change this, and it is
in CVS now, committed a week or two ago.

Peter, are you saying you don't want to require all columns to be
specified when INSERT doesn't list the columns?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [PATCHES] ANSI Compliant Inserts

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> Peter, are you saying you don't want to require all columns to be
> specified when INSERT doesn't list the columns?

Yes, that's what I'm saying.  Too much breakage and annoyance potential in
that change.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: [PATCHES] ANSI Compliant Inserts

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Bruce Momjian writes:
> 
> > Peter, are you saying you don't want to require all columns to be
> > specified when INSERT doesn't list the columns?
> 
> Yes, that's what I'm saying.  Too much breakage and annoyance potential in
> that change.

OK, how about a NOTICE stating that the missing columns were filled in
with defaults?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [PATCHES] ANSI Compliant Inserts

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> OK, how about a NOTICE stating that the missing columns were filled in
> with defaults?

Please not.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: [PATCHES] ANSI Compliant Inserts

From
Thomas Lockhart
Date:
...
> OK, how about a NOTICE stating that the missing columns were filled in
> with defaults?

Yuck. There is a short path from that to rejecting the insert, but
printing the entire insert statement which would have been acceptable in
the error message ;)
                  - Thomas