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

Patch for updatable views

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch for updatable views
Date: 2006-07-25 16:31:32
Message-ID: FF01669BA27FFC99B1D2304A@[172.26.14.247] (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-patches
Hi folks,

please find attached an implementation for updatable views. Included are 
support
for pg_dump and information_schema, regression test and documentation are
missing. Also, there's currently no upgrade path for older PostgreSQL 
versions and
user defined rules on views. I have some code which drops the implicit 
created
rules silently if someone wants to have its own rule, but this needs some 
discussion,
i think.

The patch covers the whole SQL92 functionality and doesn't create any 
rules, if
a given view is considered not to be compatible with SQL92 definitions. The 
supported
syntax is

CREATE VIEW foo AS .... [ WITH [ CASCADED | LOCAL ] CHECK OPTION ]

The check option is implemented as a conditional rule with a simple system 
function, which
checks the given expression tree to be true or false and raises an error in 
the latter case.
There's also a little change in the rewriter semantics, as i treat implicit 
(view update rules
created automatically) and explicit rules (rules created by any user) 
differently.
This involves some changes to the system catalog (especially
pg_rewrite and pg_proc), so be prepared to do an initdb. There are new files
in src/backend/rewrite/view_update.c and src/include/rewrite/view_update.h, 
too.

Please note that the patch currently breaks some regression tests, but 
these are
mostly due to duplicated rules on views and additional notice messages. 
Also, i
have dropped support for updatable views which contains indexed array 
fields
of tables (like SELECT foo[3], foo[2] FROM bar). These are treated 
non-updatable and
someone needs his own rules here.

I hope there aren't too many open points here, so this patch could be 
considered
for inclusion in 8.2.

Looking forward your opinions...

-- 
  Thanks

                    Bernd

Attachment: pgsql-view_update_8.2dev.tar.bz2
Description: application/octet-stream (24.5 KB)

pgsql-patches by date

Next:From: Andrew DunstanDate: 2006-07-25 16:41:41
Subject: Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
Previous:From: Hiroshi SaitoDate: 2006-07-25 16:30:23
Subject: Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug

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