Problem with rules & ODBC - Mailing list pgsql-general

From Mario Weilguni
Subject Problem with rules & ODBC
Date
Msg-id 00082319510009.00407@loki
Whole thread Raw
Responses Re: Problem with rules & ODBC
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----

I've a strange problem using the following configuration:
* Access97 via ODBC
* Postgres 7.0.2
* a table with automatic logging of updates into another table using rules

Example:
create table test (
  name varchar(32),
  surname varchar(32),
  birthday datetime
....
....
);

create rule r1 as on update to test
  where old.name<>new.name
  do insert into protocol ('now', USER, 'name', old.name, new.name);

create rule r2 as on update to test
  where old.surname<>new.surname
  do insert into protocol ('now', USER, 'surname', old.surname, new.surname);

Of course this is just a small example, I did not even test if the syntax is
ok, but you should get the point.

When I now use psql to modify some entries, everything works as expected.
When trying to upadte using Access, Access reports an error that the entry
has been changed by a different user and cannot be updated.

Then I've enabled ODBC logging, and found out that the Postgres ODBC driver
is reporting something like this:
UPDATE test SET ....
INSERT 2344934 1
UPDATE 1
ROLLBACK

Without usage of rules it looks like this:
UPDATE test SET ....
UPDATE 1
COMMIT
and everything is ok.

My guess is that the problem is the report of the "INSERT 2344934 1", which
seems to be due to the rules fireing. This seems to confuse Access97 (and
Access2000 as well). WinSQL has no problems with this.

Did anybody else encouter this or a similar problem? Any ideas how to prevent
this (maybe some special ODBC driver settings? Or Access options?)?

Mario Weilguni

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOaQPBAotfkegMgnVAQGgiwP/fk7onp8x+3U2AtYTDQCMErcX5cZqoQ8t
m69eNHBcArAXSne0B0SgLMr1SlO2VyNcxwP4GgfIOOuYfUxgOqFPcDd0xV7lILYm
ISAYywU3ZECQ5AkmjYWhNmvGLbybjXtczlE0Mb2zHCIti0xku18VQnuEd7Ha8uez
H5SaUrY/gw0=
=gisG
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: richard excite
Date:
Subject: 2-phase commit
Next
From: Peter Haight
Date:
Subject: Large object insert performance.