On Thu, 19 May 2016 10:29:48 +1000
"dandl" <david at andl.org> wrote:

> > Restriction is applied to the values of the tuple.  The number of
> > tuples is not a value of the tuple.
> 
> No, I can't agree. Restriction is a membership test, a function on
> members: should this tuple be included in the result set or not?
> Cardinality of a set is a second order function on the members of the
> set, obtainable simply by examining all the tuples in the set at the
> same time. There is no a priori reason not to use cardinality in a
> membership functions.

That's an interesting perspective.  If you're dealing with genuine
sets, and you define your language in terms of second-order operations,
then something like LIMIT could be included.  Would have to be, I
guess.  

But that's not what SQL is, or what LIMIT is. 

You were rather dismissive of my nth() function, but that approximates
what LIMIT does (approximation is all that's possible) with a 
first-order operation.  

BTW, I still think you're agreeing with me.  I'm insisting on using the
"values of the tuple", implicitly restricted to first-order
operations.  Cardinality, as you say, as a second order *function*,
hardly a "value".  But at least I understand your argument now.  

> To that you can successively add negation, recursion, higher order
> functions and fixpoint/while. Each of those allows operations that
> others do not, but there is disagreement about which should be
> considered 'relational'. 

OK, I see.  It's fitting that the debate is about the definition of the
set of relational operators.  

I'm conservative in that regard.  I'm wary of the complexity that
higher-order operations bring to the language.  Each higher level
brings (I suspect) more complexity than the prior, while solving fewer
new problems.  

I think recursion is a good extension, and a good example.  It permits
the expression of hierarchies.  It's indispensable ... for maybe 1% of
queries.  

I guess you could convince me it makes SQL Turing Complete, but that's
a very dense thicket.  Recursive structures are useful.  If they could
be manipulated without making the language Turing Compiete, I'd
consider that a plus.  

> Thank you for the reference -- I didn't have that one. I'm familiar
> with the material.

You're welcome, and it shows.  

I think we've managed to hash out some agreement:

1.  Second order functions are "relational", or can be, depending on
one's definition.  We have support for them already in SQL.  

2.  Limit, as currently implemented, lies outside the theory because it
doesn't operate on sets.  

Regards, 

--jkl


Reply via email to