Re: [HACKERS] INSERT in 7.0 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] INSERT in 7.0
Date
Msg-id 24381.945354945@sss.pgh.pa.us
Whole thread Raw
In response to INSERT in 7.0  (Karel Zak - Zakkr <zakkr@zf.jcu.cz>)
List pgsql-hackers
Karel Zak - Zakkr <zakkr@zf.jcu.cz> writes:
> What is changed on INSERT/max() in v7.0? (CVS - today).

> template1=> INSERT INTO pg_group VALUES ('abg_root', max(grosysid)+1, '{}');
> ERROR:  attribute 'grosysid' not found

That's the way it should work, AFAICS.  VALUES() isn't supposed to
contain anything except constant expressions.  Perhaps what you are
after would be more properly expressed as

INSERT INTO pg_group SELECT 'abg_root', max(grosysid)+1, '{}' FROM pg_group;

6.5 may have accepted the other, but it was an artifact of extremely
broken code...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] initdb / pg_version
Next
From: "Ansley, Michael"
Date:
Subject: RE: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING