Data conversion error converting "NULL to assigned row value"

205 views
Skip to first unread message

Stéphane BARBARAY

unread,
Dec 7, 2021, 11:42:27 AM12/7/21
to H2 Database
Hello

Did someone encountered this type of message since 2.0?

I get this message on a request that has always worked with version 1.4

Here is the request 

UPDATE `DATA`.`CDQITT_000304` AS T SET (`Engzr_POASTMorder`, `Engzr_PONature`)=(SELECT `Engzr_POASTMorder`, `Engzr_PONature` FROM `DATA`.`CDQFTT_000098` AS TT, `TMP`.`CDCPL_Temp` AS Tmp WHERE Tmp.RecNo = T.T_RecNo02_IT AND TT.None_CDLang = T.None_CDLang AND TT.Engzr_POASTM=Tmp.Engzr_POASTM)

if I understand the error that would mean that the SELECT result is NULL... but that's not the case, I get 20 lines with the following request :

SELECT  T.T_RecNo02_IT, TT.None_CDLang, TT.`Engzr_POASTMorder`, `TT`.`Engzr_PONature` FROM `DATA`.`CDQITT_000304` AS T, `DATA`.`CDQFTT_000098` AS TT, `TMP`.`CDCPL_Temp` AS Tmp WHERE Tmp.RecNo = T.T_RecNo02_IT AND TT.None_CDLang = T.None_CDLang AND TT.Engzr_POASTM=Tmp.Engzr_POASTM;

So why do I get this error?

this update request should update 20 lines / 28 on the destination tables, and only 2 columns / 4 (there is 6 columns including 2 for the primary key)
and there is no null value from the select (but all rows/cols except keys are null before update on destination table)

regards

Evgenij Ryazanov

unread,
Dec 7, 2021, 7:47:42 PM12/7/21
to H2 Database
Hello.

It is a wrong error message indicating that no rows were selected in a subquery. I filled a new issue about it:

Stéphane BARBARAY

unread,
Dec 8, 2021, 2:06:02 AM12/8/21
to H2 Database
Hello Evgenij

No rows? even when the subquery will return 20 rows (see my second request to verify that rows were returned)?!!

I'll try to drop non related tables and extract the data to a sql file to join this in the issue...

Evgenij Ryazanov

unread,
Dec 8, 2021, 2:46:00 AM12/8/21
to H2 Database
With 20 rows H2 should throw Scalar subquery contains more than one row

You need to provide a complete standalone test case.

Stéphane BARBARAY

unread,
Dec 8, 2021, 8:29:14 AM12/8/21
to H2 Database
OK, since I provided a test case, I saw that you did understood what I meant, found the bug, and made a PR 
Thanks for all

Evgenij Ryazanov

unread,
Dec 8, 2021, 9:09:26 AM12/8/21
to H2 Database
Yes, I completely forget that empty multi-column subquery should produce a row with null values, just like empty single-column subquery produces a null value.
Reply all
Reply to author
Forward
0 new messages