Positional update on non-trivial queries

29 views
Skip to first unread message

Dimitry Sibiryakov

unread,
Jul 19, 2024, 12:34:19 PM7/19/24
to firebird...@googlegroups.com
Hello All,

Simple "select 1 one from rdb$database for update" works and produces
positioned cursor.
Complex "select 1 one from rdb$database join rdb$relations on 1=1" works but
produces not-positioned cursor (i.e. "for update" is ignored).

But if I create a view as "create view d_v as select 1 one from rdb$database
join rdb$relations on 1=1" things become surprising:

SQL> select 1 from d_v for update;

CONSTANT
============
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8, actual 16

Is it expected behaviour or a bug?

--
WBR, SD.

Dmitry Yemanov

unread,
Jul 20, 2024, 3:20:24 AM7/20/24
to firebird...@googlegroups.com
19.07.2024 19:34, 'Dimitry Sibiryakov' via firebird-support wrote:
>
>   But if I create a view as "create view d_v as select 1 one from
> rdb$database join rdb$relations on 1=1" things become surprising:
>
> SQL> select 1 from d_v for update;
>
>     CONSTANT
> ============
> Statement failed, SQLSTATE = 22001
> arithmetic exception, numeric overflow, or string truncation
> -string right truncation
> -expected length 8, actual 16
>
>   Is it expected behaviour or a bug?

I'd expect a different (more explicit) error to be raised instead.


Dmitry


Dimitry Sibiryakov

unread,
Jul 20, 2024, 4:12:49 AM7/20/24
to firebird...@googlegroups.com
Dmitry Yemanov wrote 20.07.2024 9:20:
>>
>>    Is it expected behaviour or a bug?
>
> I'd expect a different (more explicit) error to be raised instead.

In this case the behaviour will be inconsistent with join case which doesn't
throw error at all.
Besides, views can be updatable.

--
WBR, SD.

Dimitry Sibiryakov

unread,
Jul 20, 2024, 11:59:49 AM7/20/24
to firebird...@googlegroups.com
Dmitry Yemanov wrote 20.07.2024 9:20:
> I'd expect a different (more explicit) error to be raised instead.

I wonder what ANSI SQL standard says about positional update of result set
from joined tables.

--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages