Thread: Re: Problem importing auto-increment fields in MS Access to Postg reSQL.

Re: Problem importing auto-increment fields in MS Access to Postg reSQL.

From
"Henshall, Stuart - WCP"
Date:
Hello,
    Auto-increment type doesn't exist in pgsql per se. However there is
a very similar serial type. This type is basically int4 with a default value
of the nextval of a sequence (automatically generated by seriasl type).
Because this is a default value, the record must be inserted before the
value is generated. To get around this I have ODBC pass-through queries set
to select the nextval of the sequence (eg select nextval('"jobs_id_seq"');)
I then would INSERT INTO jobs (id) VALUES (<whatever the value was>); I can
then open a recordset that references this value, or add as a where
condition on a form opening etc...  (I have these two SQL statements
basically together in a function that returns the value of the ID).
hmm, maybe this should be on -general, oh well
hope this was useful,
- Stuart
P.S. As a sidenote PG 7.1 has been released.