[Libreoffice-bugs] [Bug 116982] FIREBIRD : Migration : import of table with autoincrement leads to integrity violation when attempting to add new record

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Apr 14 20:12:12 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=116982

--- Comment #6 from robert at familiegrosskopf.de ---
(In reply to robert from comment #5)
> This is the code for getting all generators:
> 
> SELECT * FROM RDB$GENERATORS;
> 
> ... but don't know the right generator.
> 
> Could we save the name of the generator in the description of the field,
> which should be the autovalue-field?
> 
> For HSQLDB you haven't to know this, because the code only need the table
> and the field.

Have found this:
SELECT RDB$FIELD_NAME, RDB$RELATION_NAME, RDB$GENERATOR_NAME  FROM
RDB$RELATION_FIELDS WHERE RDB$GENERATOR_NAME IS NOT NULL

Will show the generatorname for the fields of the tables with autoincrement
value.

Generatornames are RDB$1, RDB$2 and so on ...
ALTER SEQUENCE RDB$1 RESTART WITH 10;
Sets the generator to 10. This should be the last value of the
autoincrement-field. Not the value, which should be generated as next value!
Next autoincremented value will be 11, when "RESTART WITH 10" is set - a little
bit confusing.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180414/e5c1296f/attachment.html>


More information about the Libreoffice-bugs mailing list