Subject | Re: autoincrement fields |
---|---|
Author | Roman Rokytskyy |
Post date | 2006-10-29T00:11:36Z |
> > CREATE TABLE person ( id SERIAL, name TEXT );There are few more issues...
> >
> > is automatically translated into this:
> >
> > CREATE SEQUENCE person_id_seq;
> > CREATE TABLE person (
> > id INT4 NOT NULL DEFAULT nextval('person_id_seq'),
> > name TEXT );
> >
> > Would there be any issues with doing the same for Firebird?
>
> Just the usual problem of name lengths in the creation of the
> generator, but we could just use some sort of automatic name
> generation...
a) our gbak has problem with restoring the tables containing "DEFAULT
gen_id(....)" - for some reason generators are created after the
tables. The fix is not trivial.
b) systems with autoincrement fields (at least MS Access, MS SQL
Server and MySQL) do not have INSERT ... INTO ... RETURNING, but use
some kind of "SELECT @@lastval" statement. So even if we provide an
autoincrement type, there still will be some effort to port the
application.
Roman