Re: 7.0 bug ??
От | Tom Lane |
---|---|
Тема | Re: 7.0 bug ?? |
Дата | |
Msg-id | 24638.957144664@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | 7.0 bug ?? (claud yu <claud@tera.cs.tku.edu.tw>) |
Список | pgsql-bugs |
claud yu <claud@tera.cs.tku.edu.tw> writes: > freechange=# insert into accountloginrec values (1,'test','test','test',NOW(),NOW()+30,Max(eshopcode)+1,null); > ERROR: Attribute 'eshopcode' not found > The same syntax at 6.5.3 is OK !! Not a 7.0 bug, but a 6.5 bug --- it shouldn't have accepted that. The correct SQL-approved way to do this sort of thing is insert into accountloginrec select 1,'test','test','test',NOW(),NOW()+30,Max(eshopcode)+1,null from accountloginrec; A values() expression is a standalone row-value constructor; it can't legitimately contain any references to the insert destination table. In fact the way INSERT is supposed to work is that it's processed as INSERT INTO dest_table <something> where the <something> is a row-value-yielding expression that would have the same meaning whether it appeared in INSERT or not. 6.5 was in error to accept free variables in the <something> as references to the insert's destination table. The INSERT...SELECT way works in 6.5 too, btw. regards, tom lane
В списке pgsql-bugs по дате отправления: