Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D98A41337B80 for ; Sat, 16 Oct 2010 22:02:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 96811-02 for ; Sun, 17 Oct 2010 01:02:13 +0000 (UTC) X-Greylist: delayed 00:23:32.401222 by SQLgrey-1.7.6 Received: from mail.warwaris.at (mail02.warwaris.at [78.47.66.147]) by mail.postgresql.org (Postfix) with ESMTP id B23211337B7F for ; Sat, 16 Oct 2010 22:02:13 -0300 (ADT) Received: from localhost (unknown [127.0.0.1]) by mail.warwaris.at (Postfix) with ESMTP id 9DD92DDEE4 for ; Sun, 17 Oct 2010 00:38:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at acme.co.at Received: from mail.warwaris.at ([127.0.0.1]) by localhost (mail02.warwaris.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FZ43hO5cBA+T for ; Sun, 17 Oct 2010 02:38:39 +0200 (CEST) Received: from [192.168.1.7] (cm199-90.liwest.at [81.10.199.90]) (Authenticated sender: thomas) by mail.warwaris.at (Postfix) with ESMTP for ; Sun, 17 Oct 2010 02:38:39 +0200 (CEST) Subject: Writable Views as Tables (for clients that won't write to views) From: Thomas Warwaris To: pgsql-jdbc@postgresql.org In-Reply-To: <20101015170801.59F0210C6C5@mail.warwaris.at> References: <20101015170801.59F0210C6C5@mail.warwaris.at> Content-Type: text/plain; charset="UTF-8" Date: Sun, 17 Oct 2010 02:38:38 +0200 Message-ID: <1287275918.4712.48.camel@bes.tw.priv> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.213 tagged_above=-10 required=5 tests=BAYES_20=-0.001, RCVD_IN_NJABL_PROXY=2.224, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: ** X-Archive-Number: 201010/119 X-Sequence-Number: 21087 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.