Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 10A059FB3C0 for ; Wed, 11 Oct 2006 05:44:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 35387-07 for ; Wed, 11 Oct 2006 08:43:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from serveurmail01.codata.be (125.123.146.82.ipv4.evonet.be [82.146.123.125]) by postgresql.org (Postfix) with ESMTP id C84F59FA004 for ; Wed, 11 Oct 2006 05:43:56 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by serveurmail01.codata.be (Postfix) with ESMTP id 0B495183870F for ; Wed, 11 Oct 2006 10:43:51 +0200 (CEST) X-DSPAM-Result: Innocent X-DSPAM-Processed: Wed Oct 11 10:43:47 2006 X-DSPAM-Confidence: 0.5275 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 452caec3150691336712104 X-DSPAM-Factors: 27, X-Virus-Scanned: amavisd-new at Received: from serveurmail01.codata.be ([127.0.0.1]) by localhost (serveurmail01.codata.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fy12VTbr5XUQ for ; Wed, 11 Oct 2006 10:43:47 +0200 (CEST) Received: from [127.0.0.1] (173.177-112-217.adsl.belcenter.be [217.112.177.173]) by serveurmail01.codata.be (Postfix) with ESMTP id B7A5818386F9 for ; Wed, 11 Oct 2006 10:43:46 +0200 (CEST) Message-ID: <452CAEC2.5070903@freesurf.fr> Date: Wed, 11 Oct 2006 10:43:46 +0200 From: Arnaud Lesauvage User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Access2000 & sequence as primary key in view : #DELETED Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0641-1, 10/10/2006), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.335 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/19 X-Sequence-Number: 8282 Hi list ! I created a view in postgresql (quite complex, multiple tables are linked). The aim is to link it in acces via ODBC. In needed to auto-number the rows, and I created a sequence for that (thanks to a good advice on the GENERAL list). In Access, I know that I need good primary keys on my linked tables (integer, single column). I though that using this column as a primary key would be a good idea . The view looks like this : CREATE OR REPLACE VIEW my_view AS SELECT nextval('my_view_seq'::regclass)::integer AS "index", FROM ; Note I had to explicitely cast the sequence as integer, because it was detected as a decimal field in Access (equivalent to NUMERIC in PostgreSQL). In Access I link my tables via some VBA code. I have a routine that creates the primary keys when they are non-trivial. In this case, the routine executes "CREATE UNIQUE INDEX my_pkey ON TABLE my_linked_table (index)". The primary key is created OK, the column is recognized as integer-type in Access, but when I open the table all the fields are marked as #DELETED. Where exactly is the problem here ? Is it just impossible to use this sequence-generated field as a primary key in Access ? Thanks for your help on this ! -- Arnaud