What is a type error?

Joachim Durchholz jo at durchholz.org
Sun Jul 16 15:59:39 EDT 2006


Marshall schrieb:
> 
> Good point. Perhaps I should have said "relational algebra +
> variables with assignment." It is interesting to consider
> assignment vs. the more restricted update operators: insert,
> update, delete.

Actually I see it the other way round: assignment is strictly less 
powerful than DML since it doesn't allow creating or destroying 
variables, while UPDATE does cover assignment to fields.
(However, it's usually new+assignment+delete vs. INSERT+UPDATE+DELETE, 
at which point there is not much of a difference.)

>>>>> Okay. At this point, though, the term aliasing has become extremely
>>>>> general. I believe "i+1+1" is an alias for "i+2" under this definition.
>>>> No, "i+1+1" isn't an alias in itself. It's an expression - to be an
>>>> alias, it would have to be a reference to something.
>>>>
>>>> However, a[i+1+1] is an alias to a[i+2]. Not that this is particularly
>>>> important - 1+1 is replacable by 2 in every context, so this is
>>>> essentially the same as saying "a[i+2] is an alias of a[i+2]", which is
>>>> vacuously true.
 >>>
>>> To me, the SQL with the where clause is like i+2, not like a[2].
>> I'd say WHERE is like [i+2]: neither is valid on its own, it's the
>> "selector" part of a reference into a table.
> 
> Is it possible you're being distracted by the syntax?

I think that's very, very unlikely ;-)

 > WHERE is a
> binary operation taking a relation and a filter function. I don't
> think of filters as being like array indexing; do they appear
> analogous to you?

Yes.

Filters are just like array indexing: both select a subset of variables 
from a collection. In SQL, you select a subset of a table, in a 
programming language, you select a subset of an array.

(The SQL selection mechanism is far more flexible in the kinds of 
filtering you can apply, while array indexing allows filtering just by 
ordinal position. However, the relevant point is that both select things 
that can be updated.)

>> I admit that identity cannot be reliably established in SQL. The
>> identity of a record isn't available (unless via OID extensions).
>> However, it is there and it can have effect.
> 
> Yes, I think I see what you mean now. This is in part a consequence
> of the restricted update operators.

I don't think so. You can update SQL records any way you want.
The unavailability of a record identity is due to the fact that, well, 
it's unavailable in standard SQL.

Regards,
Jo



More information about the Python-list mailing list