Обсуждение: [INTERFACES] MSAccess and primary keys
[Sorry for reposting this, the subject got garbled.] Hello, I have a rather anoying problem. I am linking a quite large M$Access application to a PostgreSQL database with a a lot of relations (primary keys/foreign keys). In all my tables I have created primary keys (to keep M$Access happy ;-). Unfortunately, when I link my application to the database, Access asks me for each and every table (there are more than 80 of them) what I want to use for unique index field. I thought the primary key spec would do just that? All tables are designed like the one below: create table globalafvigelse ( id serial , startdato date, slutdato date, dagskema varchar(50), primary key (globalafvigelse) ); Greetings, Leif (leif@danmos.dk)
On Sat, 15 May 1999 leif@danmos.dk wrote: > create table globalafvigelse > ( > id serial , > startdato date, > slutdato date, > dagskema varchar(50), > primary key (globalafvigelse) > ); You're misusing the PRIMARY KEY constraint; you're supposed to give it a list of attributes which function as the primary key for the table. I'm surprised that was accepted at all. I think what you want is: create table globalafvigelse ( id serial, ... primary key (serial) ); Geoff
Make sure the "Recognize Unique Indexes" flag is turned on in the PostgreSQL ODBC driver. -----Original Message-----From: leif@danmos.dk [SMTP:leif@danmos.dk]Sent: Saturday, May 15, 1999 2:35 AMTo: pgsql-interfaces@postgreSQL.orgSubject: [INTERFACES] MSAccess and primary keys [Sorry for reposting this, the subject got garbled.] Hello, I have a rather anoying problem. I am linking a quite largeM$Access application to a PostgreSQL database with a a lot ofrelations(primary keys/foreign keys). In all my tables I havecreated primary keys (to keep M$Access happy ;-). Unfortunately,whenI link my application to the database, Access asks me foreach and every table (there are more than 80 ofthem) what Iwant to use for unique index field. I thought the primary keyspec would do just that? All tables are designed like the one below: create table globalafvigelse ( id serial , startdato date, slutdato date, dagskema varchar(50), primarykey (globalafvigelse) ); Greetings, Leif (leif@danmos.dk)
On Sat, 15 May 1999, Geoffrey C. Speicher wrote: > You're misusing the PRIMARY KEY constraint; you're supposed to give it a > list of attributes which function as the primary key for the table. I'm > surprised that was accepted at all. I think what you want is: > create table globalafvigelse > ( > id serial, > ... > primary key (serial) > ); primary key(id) you mean? :) The serial datatype automatically makes the field a primary key, so that would be unnecessary anyway. Ole Gjerde