Wrong behavour FOR <select_stmt> [AS CURSOR cursorname] with next update and
delete
-----------------------------------------------------------------------------------
Key: CORE-5794
URL: http://tracker.firebirdsql.org/browse/CORE-5794
Project: Firebird Core
Issue Type: Bug
Affects Versions: 3.0.3
Reporter: Sergey Borisov
CREATE EXCEPTION TEST_EXCEPTION 'TEST';
CREATE TABLE TEST_TABLE (
ID INTEGER,
VAL INTEGER
);
INSERT INTO TEST_TABLE (ID, VAL) VALUES (1, 10);
SET TERM ^ ;
CREATE OR ALTER TRIGGER TEST_TABLE_BD FOR TEST_TABLE
ACTIVE BEFORE DELETE POSITION 0
as
begin
IF (OLD.Val >0) THEN EXCEPTION TEST_EXCEPTION 'It is forbidden to delete row
with Val>0 (ID = '||Coalesce(OLD.ID, 'null')||',
Val='||Coalesce(old.Val,'null')||')';
end^
Execute block
as
declare variable curVal integer;
declare variable curID integer;
begin
for select ID, VAL
from TEST_TABLE
where VAL>0
into curID, CurVal
as cursor TmpCursor
do begin
update TEST_TABLE
set Val=0
where current of TmpCursor;
--This expression must be executed without exception (because now Val=0),
but an error occurs.
delete from TEST_TABLE
where current of TmpCursor;
end
end^
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel