On Thu, 2004-09-16 at 01:05, Tom Lane wrote:
> That seems fairly unworkable.  For example
> 
>       SELECT (2,3,4);
> 
> is valid SQL.

Good point. The disambiguation algorithm I suggested isn't sufficient,
but I think there ought to be _some_ reasonable algorithm.

>From glancing over the SQL commands, I believe SELECT is the only case
where a SQL statement starts with a T_WORD token followed by a left
parenthesis (correct me if I'm mistaken). If that's the case, one
solution would be to just special-case SELECT: if the name of the
"function" is 'select', we treat it as a SQL statement and not a
function call. Of course, this wouldn't apply if the function name is
double-quoted or schema-qualified.

Another technique would be to delay distinguishing between these two
cases until the function is first invoked; then lookup the function name
in pg_proc, and if a candidate function with that name is found, assume
it's a function call. I don't really like this technique, though.

> Also I'm not sure if you can extend this to cope with
> schema-qualified function names.

Sorry, I forgot to mention that -- yes, that is intended.

-Neil



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to