Re: problem with serial data type and access

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Ottavio Campana" <ottavio(at)campana(dot)vi(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem with serial data type and access
Date: 2008-05-16 14:38:03
Message-ID: 396486430805160738i18cd155dtbe8a0cdddb6f005c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, May 15, 2008 at 6:54 AM, Ottavio Campana <ottavio(at)campana(dot)vi(dot)it> wrote:
> I'm dealing with this scenario: access 97 is connected through odbc to a
> postgresql server. All tables are saved in postgresql and access is used
> only to generated the program interface.
>
> Everything works fines, but I'm having problems with the serial data type. I
> know a serial is an integer having as default the next value of a sequence.
> Since it is an integer, access does not recognize it as an autoincrement
> value, and it asks for is value.
>
> Did anyone of you already have this problem?

Back when I was using V95, I remember having this problem and finding
a simple way to get around it. The only problem is that I can't
remember what it was. MS-Access 2003 doesn't seem to suffer from this
problem.

One brute-force method to get around it is to create a function that
uses an ADO connection to call the PostgreSQL back-end for
nextval('sequence_name'). Next using the Before_insert() event in
access, you could manually set the new id for your primary key and
complete the record insertion.

--
Regards,
Richard Broersma Jr.

Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ${spencer} 2008-05-16 14:56:00 writing a function without installing a language
Previous Message Adrian Klaver 2008-05-16 14:18:43 Re: problem with serial data type and access