Skip site navigation (1) Skip section navigation (2)

Writable Views as Tables (for clients that won't write to views)

From: Thomas Warwaris <psql_list(at)warwaris(dot)at>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Writable Views as Tables (for clients that won't write to views)
Date: 2010-10-17 00:38:38
Message-ID: 1287275918.4712.48.camel@bes.tw.priv (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi,

i am working towards proof of concept code to trick "intelligent" JDBC
Clients into believing that views are tables (so that they write in it)
and i am reaching the point where things start to work.

I'd love to get some response: Ideas about what things i could break
with that, maybe additional ideas - and maybe there's a brighter idea
than that?

By now it works that way:

An additional table in the database holds the table oid and the name of
the column, that will be given to the client as primary key. It's ok for
me in that simple way, because in the view i can build the pkey from
whatever i want anyway.

Then, in the metadata:
- the view is reported to the client as a table
- the pkey column is reported as not nullable, auto increment
- an index is returned (with CARDINALITY of count(*) and PAGES beeing
fantasy)

Does anyone know, what clients need PAGES for? Is it used with SQL
backends?

By now, that seems to be enough for oobase to work with it.

Todo: Read only and not null constraints.

Some thoughts:
Maybe not "a good idea to do that in the driver" - but it is generic,
and works with JDBC clients, that try to be more intelligent than the
database.

Of course it breaks clients, when they try to change the table
structure. But if they put their fingers in there, they'd better know
about writable views anyway.


pgsql-jdbc by date

Next:From: David FetterDate: 2010-10-19 15:03:06
Subject: Re: DatabaseMetaData.getTablePrivileges()
Previous:From: dmpDate: 2010-10-16 16:15:00
Subject: Re: DatabaseMetaData.getTablePrivileges()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group