dbTalk Databases Forums  

Setting up updatable views ?

comp.databases.theory comp.databases.theory


Discuss Setting up updatable views ? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cimode
 
Posts: n/a

Default Setting up updatable views ? - 10-02-2007 , 03:29 AM






While working on a db core on these last years, one of the question
that gave me most difficulty was what would be an efficient taxonomy
to list prequisites for a system to support updateable views. I would
be happy to exchange on that subject.


Reply With Quote
  #2  
Old   
JOG
 
Posts: n/a

Default Re: Setting up updatable views ? - 10-03-2007 , 07:21 PM






On Oct 2, 9:29 am, Cimode <cim... (AT) hotmail (DOT) com> wrote:
Quote:
While working on a db core on these last years, one of the question
that gave me most difficulty was what would be an efficient taxonomy
to list prequisites for a system to support updateable views. I would
be happy to exchange on that subject.
View updatability is a very interesting area imo. Perhaps you would
like to offer your initial thoughts?



Reply With Quote
  #3  
Old   
Cimode
 
Posts: n/a

Default Re: Setting up updatable views ? - 10-04-2007 , 06:21 AM



On Oct 4, 1:21 am, JOG <j... (AT) cs (DOT) nott.ac.uk> wrote:
Quote:
On Oct 2, 9:29 am, Cimode <cim... (AT) hotmail (DOT) com> wrote:

While working on a db core on these last years, one of the question
that gave me most difficulty was what would be an efficient taxonomy
to list prequisites for a system to support updateable views. I would
be happy to exchange on that subject.

View updatability is a very interesting area imo. Perhaps you would
like to offer your initial thoughts?
Sure...A little history to clarify the viewpoint...Some years ago, I
started coding an assembler db core that would respect as much as
possible the fundamental principle of independence between logical and
physical layer as defined in RM. The purpose of that effort was to
identify some computing (non fundamental) issues that would be faced
by any developper that would attempt to develop a trdbms...

The primary serious issue I faced was to attempt to establish a
computing model that would *coherently* support the concept of unique
tuple identification *without* using directly physical pointers. The
idea was to establish a *logical* solution to the problem of how a
tuple could be identified within a given domain of value or a specific
relation. At that point, I used some trigonometrics to establish
mathematical functions that establish *discernability* over elements
in a degree N relation. I started first with a degree 2 relation
tuple that I reduced to a single numeric value. Then, that function
could allow to uniquely identify that specific tuple and that tuple
only single value (in fact, it could reestablish the identifiers of
the 2 value of each separate attributes within their respective
domain). I later attempted to determine a manthematical function that
would allow a generalization of the property of discernability to a
degree N relation tuple.

For testing such solution and making sure it does not have aspects I
have not thought of, I started imagining a test scenario that would
reveal the limits of such solution through how it would be (or not be)
practical to allow the support of view updates in a system. So I
started focusing on establishing a taxonomy of requirements that would
allow view updates. So here's the taxonomy I came up with so far:

Quote:
Identification requirements: all requirements that a computing model should meet in terms of how such system establishes discernability between tuples to support efficiently view updates.
Predictability requirements: all requirements that a computing model should meet to allow *predictable* updates. In such requirements, I usually ask myself question such as: how ought a grouped query ought to handle to be updated and how would it give a result that would be reasonnable and coherent to understanding.
Concurrency requirements: all requirements that a computing model should meet to allow comit/rollback principle over view operations. Here I ask my self questions such as : can we apply a 2 phase commit model to hadle concurrency?
So far I have focused onto answering the first part and here is what I
came up with:

Identification requirements

Quote:
The identifier value for a specific tuple is not a part of the physical layer
The identifier is the output of a mathematical function that allows to identify a point.
The above output ought to reestablish the identifiers of all attribute values into there respective domains
The identifier of a specific tuple is a stable mathematical function of the identifier of such tuple in the domain from which the relation draws tuples.
The identifier should be a numerical value that may allow not only to identify the tuple within the relation but also with the domain.
The identifier should be established at run time or at compile time.
I really hope this makes sense. I find it more and more difficult to
use online media to precisely explain what I am getting at.



Reply With Quote
  #4  
Old   
-CELKO-
 
Posts: n/a

Default Re: Setting up updatable views ? - 10-05-2007 , 11:13 AM



Quote:
what would be an efficient taxonomy to list requisites for a system to support updateable views.

From SQL FOR SMARTIES:
18.02. Updatable and Read-Only VIEWs

Unlike base tables, VIEWs are either updatable or read-only, but not
both. INSERT, UPDATE, and DELETE operations are allowed on updatable
VIEWs and base tables, subject to any other constraints. INSERT,
UPDATE, and DELETE are not allowed on read-only VIEWs, but you can
change their base tables, as you would expect.

An updatable VIEW is one that can have each of its rows associated
with exactly one row in an underlying base table. When the VIEW is
changed, the changes pass through the VIEW to that underlying base
table unambiguously. Updatable VIEWs in Standard SQL are defined only
for queries that meet these criteria

1) They are built on only one table,
2) No GROUP BY clause
3) No HAVING clause
4) No aggregate functions
5) No calculated columns
6) No UNION, INTERSECT or EXCEPT
7) No SELECT DISTINCT clause
8) Any columns excluded from the VIEW must be NULL-able or have a
DEFAULT in the base table, so that a whole row can be constructed for
insertion.

By implication, the VIEW must also contain a key of the table. In
short, we are absolutely sure that each row in the VIEW maps back to
one and only one row in the base table.

Some updating is handled by the CASCADE option in the referential
integrity constraints on the base tables, not by the VIEW
declaration.

The definition of updatability in Standard SQL is actually pretty
limited, but very safe. The database system could look at information
it has in the referential integrity constraints to widen the set of
allowed updatable VIEWs. You will find that some implementations are
now doing just that, but it is not common yet. The SQL standard
definition of an updatable VIEW is actually a subset of the possible
updatable VIEWs, and a very small subset at that. The major advantage
of this definition is that it is based on syntax and not semantics.
For example, these VIEWs are logically identical:

CREATE VIEW Foo1 -- updatable, has a key!
AS SELECT *
FROM Foobar
WHERE x IN (1,2);

CREATE VIEW Foo2 -- not updateable!
AS SELECT *
FROM Foobar
WHERE x = 1
UNION ALL
SELECT *
FROM Foobar
WHERE x = 2;

But Foo1 is updateable and Foo2 is not. While I know of no formal
proof, I suspect that determining if a complex query resolves to an
updatable query for allowed sets of data values possible in the table
is an NP-complete problem.

Without going into details, here is a list of types of queries that
can yield updatable VIEWs, as taken from "VIEW Update Is Practical",
(Goodman 1990):

1. Projection from a single table (Standard SQL)
2. Restriction/projection from a single table (Standard SQL)
3. UNION VIEWs
4. Set difference VIEWs
5. One-to-one joins
6. One-to-one outer joins
7. One-to-many joins
8. One-to-many outer joins
9. Many-to-many joins
10. Translated and coded fields

The CREATE TRIGGER mechanism for tables an action to be performed
BEFORE, AFTER, or INSTEAD OF a regular INSERT, UPDATE, or DELETE to
that table. It is possible for a user to write INSTEAD OF triggers on
VIEWs, which catch the changes and route them to the base tables that
make up the VIEW. The database designer has complete control over the
way VIEWs are handled.




Reply With Quote
  #5  
Old   
Jon Heggland
 
Posts: n/a

Default Re: Setting up updatable views ? - 10-08-2007 , 01:36 AM



Quoth -CELKO-:
Quote:
Unlike base tables, VIEWs are either updatable or read-only, but not
both.
Base tables are both updatable and read-only?
--
Jon


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.