Igor Tandetnik wrote:
 > "Bradley Smith" wrote:
 >> 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.
 >
 > Only in a select statement, but not in a function invocation.

Yes, but the function invocation is a part of the select statement. Is 
there documentation somewhere which explains what '*' means when used in 
a function invocation?

Why would should the effect of '*' change when it is wrapped in a 
function invocation which is still part of the selection list? For example,

   select *, myfunc(*) from t;

The first '*' means "all columns", but the second '*' means "nothing". 
Both are in the same context of a select list in a select statement.


 >
 >> 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
 >
 > But you don't use the star as a select list, do you?

Yes, but indirectly. The '*' is an argument to the function which is 
used in the select list.


Regardless, thank you for your responses. Clearly, my inexperience with 
SQL is showing. Are there any other common special cases besides the 
behavior of '*'?


Thanks,
    Bradley

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

Reply via email to