Skip site navigation (1) Skip section navigation (2)

Re: Access - ODBC - serial problem...

From: Ray Aspeitia <aspeitia(at)sells(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Access - ODBC - serial problem...
Date: 2004-04-08 17:11:36
Message-ID: p06002005bc9b382e5c4b@[] (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
I haven't tried this in Access, but why not fetch the record 
identifier first then insert the record like below. Retrieving the id 
first makes sure that you get the right id, because you might be in a 
pooled connection environment, and you might not get the right id 
after the insert.

SELECT nextval('schema.sequence_for_table_record_id') AS record_id;

INSERT INTO test (record_id,code) VALUES ([retrieved record_id],20);


INSERT INTO test (record_id,code) VALUES 

Ray A.

>I have made some more tests regarding my precedent post "[ODBC] 
>Access - ODBC - index strange bug", and in fact it is not 
>index-related. The bug is just more visible when an index is used, 
>The problem comes from the serial identifier, which is not know from 
>the client at the time the record is being inserted.
>With the table described below, imagine I do, from the client:
>insert into test (code) VALUES (20);
>How does the client know the id that has been given to the record? 
>With ethereal, I could see Access fetches the id by doing a
>select id from test where code = 20"
>Of course, another record has the same code, and the wrong id is 
>being fetched back. This explains what I have noticed, and that is 
>explained below...
>Is there a solution to that, except inserting records with PL-PGSQL, 
>which I already do in some cases, by the way...?
>Is that an Access-related problem? Does it work with SQL Server?
>Thanks for your feedback...

pgsql-odbc by date

Next:From: Richard HuxtonDate: 2004-04-08 17:57:38
Subject: Re: Access - ODBC - serial problem...
Previous:From: Shachar ShemeshDate: 2004-04-08 16:44:45
Subject: Re: Access - ODBC - serial problem...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group