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

From: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
To: "'rich(at)oi(dot)co(dot)za'" <rich(at)oi(dot)co(dot)za>
Cc: "'pgsql-odbc(at)postgresql(dot)org'" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Problem importing auto-increment fields in MS Access to Postg reSQL.
Date: 2001-04-26 08:08:20
Message-ID: E2870D8CE1CCD311BAF50008C71EDE8E01CA8030@MAIL_EXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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.

Browse pgsql-odbc by date

  From Date Subject
Next Message Jean-Sébastien ANDUJAR 2001-04-27 11:57:24 Drivers ODBC
Previous Message Rich Handler 2001-04-25 15:29:44 Problem importing auto-increment fields in MS Access to PostgreSQL.