Re: views of binary operations

From: David Cressey <dcressey_at_verizon.net>
Date: Tue, 18 Jul 2006 15:44:05 GMT
Message-ID: <9l7vg.3$1g.0_at_trndny03>


"Marshall" <marshall.spight_at_gmail.com> wrote in message news:1153199212.349745.177450_at_s13g2000cwa.googlegroups.com...
> David Cressey wrote:
> >
> > Consider the following:
> >
> > CREATE VIEW US_ADDRESSES AS SELECT * FROM ADDRESSES WHERE COUNTRY_CODE =
> > 'US';
> >
> > ALTER TABLE ADDRESSES ADD COLUMN EMAIL_ADDRESS CHAR(25);
> >
> > Now, the next reference to US_ADDRESSES is going to deliver the new
column,
> > if the expansion of the wildcard is deferred. If, however, the
expansion of
> > the wildcard is carried out at definition time, the addition of the new
> > column won't be reflected in the view. Come to think of it, I forget
which
> > way Rdb worked in this regard.
>
> Interesting!
>
> Wildcard attribute specification is something of a problem for
> modularity,
> isn't it? If you fail to explicitly specify the attributes you want,
> and another
> attribute is added that otherwise would not affect your query, you
> will suddenly be getting one more column than you expected, which
> might break your code, even if you didn't need to care about the new
> attribute otherwise.
>
> I didn't say that very well, did I?
>
>
> Marshall
>

You said it just fine as far as I'm concerned.

Rdb is reasonably clever about wildcard expansion.

For instance, if you type in a query in interactive SQL, the expansion happens at runtime. Even if you read the query from a script, the expansion still happens at runtime. This can cause your query to be altered by an alteration to the reference tables or views. If that's what you want, fine.

If you embed the query in a program, however, the expansion happens at compile time (actually at precompile time). The run time database never sees the wild card.

I seem to recall that CREATE VIEW will expand the wildcard at view creation time, but I'm not sure.

I can dig up a pointer to the online documentation if you like. Or you can start at www.oracle.com/rdb and navigate your way to the relevant documanet. All this is mostly of historical interest. The reason I keep bringing up DEC Rdb (Oracle Rdb) is that the Rdb engineering team did large number of things right. It would be a shame if later engineers had to relearn the same lessons. Received on Tue Jul 18 2006 - 17:44:05 CEST

Original text of this message