Igor Tandetnik wrote:
> Bradley Smith wrote:
>> Why does a user defined function receive zero arguments when used in
>> the following expression?
>>
>>   select userfunc(*) from t;
> 
> Why would you expect otherwise? The only precedent in standard SQL for a 
> syntax like this is count(*), which doesn't need any arguments.

I expect otherwise because my understanding of SQL is that '*' refers to 
all columns in the table being queried. My understanding is supported by 
various references like the following.

Section 7.9 of http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
Under Syntax Rules 3b:

   Otherwise, the <select list> "*" is equivalent to a <value
   expression> sequence in which each <value expression> is a
   <column reference> that references a column of T and each
   column of T is referenced exactly once. The columns are ref-
   erenced in the ascending sequence of their ordinal position
   within T.

I don't know if the above URL is an accurate reference for the SQL 1992 
standard, but other SQL references also refer to '*' as meaning "all 
columns". For example, on the Wikipedia SQL page 
(http://en.wikipedia.org/wiki/SQL) in the Queries section, it states 
"The asterisk (*) in the select list indicates that all columns of the 
books table should be included in the result set."

Is my understanding of SQL incorrect?

   Bradley

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to