Thread: updatable views and optimistic locking

updatable views and optimistic locking

From
"Tambet Matiisen"
Date:
 Hi all!

We are making a project management application which makes use of VB6
bound controls and PostgreSQL updatable views. For several reasons we
had to choose client side recordsets, which means we have to use
optimistic locking scheme. Optimistic locking relies on number of
affected records, returned by query. If affected record count is 0, then
locking failed.

The problem is, that when you define rules for views, all insert, update
and delete statements return affected records 0, regardless if actual
rule statement was successful or not. This of course screws up
optimistic locking.

After searching on the net we found a patch for PostgreSQL 7.2.1:
http://archives.postgresql.org/pgsql-general/2002-05/msg00170.php

This patch works for us very well and we are happy with it. The only
problem is, that we don't want our customers to recompile PostgreSQL
every time a new version comes out. They should be able to use default
PostgreSQL installation.

And my question is: who should I bother, to have this patch included in
next PostgreSQL release? I consider it extremely useful, especially if
you happen to use bound controls and updatable views.

Thanks in advance,
Tambet Matiisen

Re: updatable views and optimistic locking

From
Hiroshi Inoue
Date:
Tambet Matiisen wrote:
>
>  Hi all!
>
> We are making a project management application which makes use of VB6
> bound controls and PostgreSQL updatable views. For several reasons we
> had to choose client side recordsets, which means we have to use
> optimistic locking scheme. Optimistic locking relies on number of
> affected records, returned by query. If affected record count is 0, then
> locking failed.
>
> The problem is, that when you define rules for views, all insert, update
> and delete statements return affected records 0, regardless if actual
> rule statement was successful or not. This of course screws up
> optimistic locking.

[snip]

> And my question is: who should I bother, to have this patch included in
> next PostgreSQL release? I consider it extremely useful, especially if
> you happen to use bound controls and updatable views.

Though my patch isn't applied, another patch to fix
the stupid bug is included in the next release.

regards,
Hiroshi Inoue
    http://w2422.nsk.ne.jp/~inoue/