Subject | Re: [firebird-support] Table and Sequence names by reference |
---|---|
Author | Ann Harrison |
Post date | 2013-11-11T15:27:03Z |
On Sun, Nov 10, 2013 at 1:56 AM, Daniel L. Miller <dmiller@...> wrote
Does that mean that if I'm going to update a sequence within a trigger or procedure, I should use the legacy gen_id() function instead of the 'alter sequence'?
I haven't checked the code, but if it follows the pattern of other DDL statements (CREATE/ALTER/DROP) ALTER SEQUENCE will not be part of PSQL. The gen_id function is part of DML and should work in procedures and triggers.Good luck,AnnP.S. Mixing user-created and sequence-derived values in identifiers complicates inserts. You have to be prepared to deal with duplicate key errors, and in the case where a user-defined value is not a duplicate, checking and resetting the sequence. That check and reset can be done in an after insert trigger so it fires only after a successful insert.