Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Incorrect value returned from scalar subquery
Wed, Mar 21 2007 12:50 PMPermanent Link

"Ole Willy Tuv"
create table t1 (col1 varchar(10));
create table t2 (col1 integer);
insert into t1 values ('A');
insert into t2 values (1);
insert into t2 values (2);

update t1 set col1 = (select 'B' from t2 where col1 = 1);

select * from t1

t1.col1 has been updated with null, instead of the correct value 'B'.

Another problem I'm seeing is that EDB accepts a non-scalar subquery as
source for a scalar assignment:

update t1 set col1 = (select 'B', col1 from t2);

The statement should raise an exception on the non-scalar subquery. The
degree can be checked early (syntax check), while the cardinality must be
checked after the result set has been processed.

Ole Willy Tuv

Wed, Mar 21 2007 4:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< create table t1 (col1 varchar(10));
create table t2 (col1 integer);
insert into t1 values ('A');
insert into t2 values (1);
insert into t2 values (2);

update t1 set col1 = (select 'B' from t2 where col1 = 1);

select * from t1

t1.col1 has been updated with null, instead of the correct value 'B'. >>

Okay, I will check it out.

<< Another problem I'm seeing is that EDB accepts a non-scalar subquery as
source for a scalar assignment: >>

I relaxed the requirement - it uses the first row for now.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image