


What is changed on INSERT/max() in v7.0? (CVS - today).

See:

--- new version:

template1=> select * from pg_group;
 groname | grosysid | grolist
---------+----------+---------
 _dummy_ |        0 | {}
(1 row)

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


--- old version (6.5):

template1=> select * from pg_group;
groname|grosysid|grolist
-------+--------+-------
_dummy_|       0|{}
(1 row)

template1=> INSERT INTO pg_group VALUES ('abg_root', max(grosysid)+1, '{}');
INSERT 10173952 1


							Karel


Thu, 16 Dec 1999 14:06:56 +0100 (CET)
Karel Zak - Zakkr <zakkr@zf.jcu.cz>
INSERT in 7.0
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

Thu, 16 Dec 1999 09:35:45 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] INSERT in 7.0 