Re: separation of church and state?

From: David Cressey <>
Date: Sat, 06 Oct 2007 19:19:35 GMT
Message-ID: <bdRNi.8551$vS1.6584_at_trndny08>

"David Portas" <> wrote in message
> "David Cressey" <> wrote in message
> news:X4PNi.3890$9r2.3214_at_trndny04...
> >
> > Oracle RDBMS, by contrast, has always forbidden ORDER BY in view
> > definitions. Other than satisfying some people's need for doctrinaire
> > purity, the RDBMS users gained nothing by this restriction.
> >
> >
> I disagree. Even in SQL, allowing ORDER BY in a view creates some tough
> problems.
> What would it actually mean for a view to be ordered? Presumably it would
> mean that at least some queries against that view should exhibit some
> pre-determined ordering. Now please define exactly which such queries
> against a view may and may not be ordered in that way (queries with joins,
> projections, aggregations, etc), including those with joins to other views
> which also have orderings of their own.

Rather than try to answer your question in detail, I'm simply going to point you to Oracle/Rdb.
It solved all the tough problems you have raised. It worked just fine in practice. If the user of a view specifies an order, it overrides the order built in to the view definition. If the view is used in a context that requires an unordered table, then it uses an unordered table.

I do not know whether or not the Rdb optimizer was smart enough to omit a superfluous order by step. I don't care, either.

And, if the view was used in the context of a report writer that only understood sequential data sources, the facility of providing an ORDER BY clause in the view definition was a godsend.

> Assuming you can define such a set of rules, how is the product supposed
> behave when the user breaks the rules by issuing a query that cannot
> properly be ordered according to the view definition?

> Do we disallow such
> queries and raise an error or do we silently return a result set that
> sorted? In the latter case, the user must be expected to understand when
> rules are being broken and presumably must also know in advance what the
> ordering is supposed be. What benefit can the user possibly gain from this
> added complexity?

I refer you again to Oracle/Rdb and to its user community. You may think it's a problem, but it isn't.

> --
> David Portas
Received on Sat Oct 06 2007 - 21:19:35 CEST

Original text of this message