Firebird 5.0 Sequence - Easy to change RDB$INITIAL_VALUE without changing the NEXT value #8269
Unanswered
AnatolyLoy
asked this question in
Q&A
Replies: 3 comments 18 replies
|
What tool you use to run script and where is commit's and\or rollback's ? hint: you didn't commit (as it is not possible) or rollback (forget ?) transaction with |
4 replies
|
RDB$INITIAL_VALUE can not be changed without re-creating of sequence. |
12 replies
|
@mrotteveel : I perfectly understand difference in exctracted DDL due to values in RDB$INITIAL_VALUE. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-- Firebird 5.0.1
`-- 1. Prepare a sequence w/o dependencies and try to recreate
CREATE SEQUENCE TEST;
SELECT RDB$INITIAL_VALUE FROM RDB$GENERATORS WHERE RDB$GENERATOR_NAME = 'TEST';
-- 1
SELECT GEN_ID(TEST, 10) FROM RDB$DATABASE;
-- 10
-- Attention, look on my hands
-- .... one....
CREATE OR ALTER PROCEDURE GET_NEXT_TEST RETURNS (ID INTEGER)
AS BEGIN ID = GEN_ID(TEST, 1); END;
-- .... two.....
RECREATE SEQUENCE TEST START WITH 0; -- was 1
/*
Cannot commit transaction:
can't format message 13:393 -- message file C:\Program Files (x86)\Firebird\Firebird_50_3055_x32\firebird.msg not found.
unsuccessful metadata update.
cannot delete.
GENERATOR TEST.
there are 1 dependencies.
SQLCODE: -607
SQLSTATE: 42000
GDSCODE: 335544351*/
-- ... three ...
SELECT GEN_ID(TEST, 10) FROM RDB$DATABASE;
-- 20 - it's not changed after exception
-- .... and FOUR!....
SELECT RDB$INITIAL_VALUE FROM RDB$GENERATORS WHERE RDB$GENERATOR_NAME = 'TEST';
-- 0
-- !!! It's changed after exception
-- ********************
-- IS IT A BUG OR FEATURE like
-- "Ability to change RDB$INITIAL_VALUE withot dropping dependencies?"?
-- ********************
-- P.S.
-- drop test DDL
DROP PROCEDURE GET_NEXT_TEST ;
DROP SEQUENCE TEST;`
All reactions