On 2015-08-22 11:42 AM, sqlite-mail wrote: > Hello ! > > I'm testing the new json functions and when I tried this: > > select json_array(*) as json from one_table; > > I've got : > > [] > > [] > > .. > > Then I tried with some custom functions accepting variable number of > parameters and realize that "*" is not expanded for function calls. > > There is any reason for it or it's a forgotten implementation ?
I don't think it is "forgotten", it simply can't really work. The asterisk "*" is a SELECT short-hand, not a function short-hand, not in any SQL that I have ever used (but I could be wrong, maybe someone has a contrary example). It is impossible for the vast majority of functions to take an indefinite parameter count that would conform to * semantics, that is: - might be Zero parameters, - might be any number higher than zero - might include NULLs (such as in LEFT-JOIN conditions) - might contain any mix of value types (especially in SQLite where no column is guranateed to only contain the value type set in the Schema) Most functions return a value based on an input that is specific. What would you envision this sort of function-call might return: SELECT Round(*) FROM users; SELECT min(*) FROM contacts; SELECT date(*) FROM schedule1; Even if you had a use-case for a table that included one column only, or perhaps a few columns all of the same type (perhaps all REAL columns) that might satisfy the circumstances to be able to run a query like the first of the three above, it would still be such an outwardly unique use-case that any effort to try and make it work like that would be vastly more than the collective global efforts to simply type the column names out when that situation arise. Lastly, even if you did try to write such a function, the function has no access to the SQL engine, it only gets the parameter the SQL engine feeds it and it must give back a single value that will be reported back as the column value for that iteration of the Cursor. Neither can you dictate from within a function to the data cursor to reshape the data cursor's column layout - even if this was programmatically possible, it would probably break relational theory. (I know with the json function you simply output a string, so the last point doesn't matter to it specifically, but the point is that such functions are not supported because they would, in the general case, not be useful)