On 21/05/2010 9:56 AM, Richard Broersma wrote:
> On Thu, May 20, 2010 at 5:52 PM,<tlange@gwdg.de> wrote:
>
>> I'm new to triggers in PostgreSQL. I have to create a trigger on insert to
>> increment a sequence to overcome MS-Access' limitation in acknowledging
>> serial "datatype".
>
> Uh? Access doesn't need to acknowledge the serial datatype.
> At-least in recent versions auto increment is recognized by MS-Access
> just fine (I'm guessing this is due to the Return clause which the
> ODBC driver automatically calls).
Really?
I had problems with Access complaining that the object it just inserted
had vanished, because the primary key Access had in memory (null) didn't
match what was stored (the generated PK). I had to fetch the next value
in the PK sequence manually and store it in Access's record before
inserting it to work around this.
I wouldn't be surprised if this actually turned out to just require some
bizarre ODBC driver parameter change, but I never figured it out and I
couldn't find any info about it on the 'net.
For the original poster: I posted some information about this at the
time I was working on it, so search the archives of this list for MS Access.
I eventually ditched Access entirely as the user who was demanding the
use of MS Access relented (phew!), so I put together a simple web-app to
do what they wanted in a day. Hopefully I'll never need to go near ODBC
again, because it's a truly "special" way to talk to PostgreSQL.
--
Craig Ringer