PostgreSQL serials in MS-Access are writable, but they are supposed to be read-only - Mailing list pgsql-odbc

From Antti Toivanen
Subject PostgreSQL serials in MS-Access are writable, but they are supposed to be read-only
Date
Msg-id 91DA99B1BB1FD211A1910008C724C36E01E9A8@TMSRV01
Whole thread Raw
Responses Re: PostgreSQL serials in MS-Access are writable, but they are supposed to be read-only
List pgsql-odbc

-----Original Message-----
From: Antti Toivanen [mailto:antti.toivanen@telemerkki.fi]
Sent:
29 May 2002 17:02
To: Dave Page
Subject: RE: [pgadmin-support] Migration from MS Sql server using the plug-in

Hi again!

 

Okay, I did as you told me to.

Basicly the PostgreSQL’s serial_col now works as supposed.

 

But I ran to a another problem, altough it is not related to the Migration plugin nor pgAdmin.

 

The MS-Access doesn’t regognize the ID field as a Auto_Increment.

For example: this is problem if I want to copy a record from table A to table B with ADO (or DAO), field by field.

If the procedure doesn’t know which fields are writable and which arent (the Auto_Increment from PostgreSQL is writable), it might try to create a duplicated key since it copies it from the old record.

 

Do you know a fully Access compatible way to handle this without possible code modifications, or can you address it for those who can make such a way possible?

 

Regards, Antti

 

-----Original Message-----
From: Antti Toivanen [mailto:antti.toivanen@telemerkki.fi]
Sent:
29 May 2002 12:15
To: pgadmin-support@postgresql.org
Subject: [pgadmin-support] Migration from MS Sql server using the plug-in

It doesnt import identity fields as serials, and thus is not usable for databases using auto_increment.

 

It is usable because when it has finished it is trivial to do something like:

 

SELECT max(serial_col) FROM tablename;

CREATE SEQUENCE serial_col_id START <result of previous query + 1>;

ALTER TABLE tablename ALTER COLUMN serial_col SET DEFAULT nextval('serial_col_id');

CREATE UNIQUE INDEX serial_col_idx ON tablename (serial_col);

Regards, Dave.

 

pgsql-odbc by date:

Previous
From: Laszlo Tibor
Date:
Subject: Re: int8 becames string in BDE :-(
Next
From: Tom Jenkins
Date:
Subject: Erwin datetime problem