From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | claud yu <claud(at)tera(dot)cs(dot)tku(dot)edu(dot)tw> |
Cc: | pgsql-bugs(at)postgreSQL(dot)org |
Subject: | Re: 7.0 bug ?? |
Date: | 2000-05-01 01:31:04 |
Message-ID: | 24638.957144664@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
claud yu <claud(at)tera(dot)cs(dot)tku(dot)edu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rolf C Stadheim | 2000-05-01 16:08:03 | gmake[3]: *** No rule to make target `page/SUBSYS.o'. Stop. ?????????????????? |
Previous Message | claud yu | 2000-05-01 00:49:42 | 7.0 bug ?? |