postgresql - Why required "=" before ANY function with array as param, in postgres procedure? -
i answering postgres question yesterday, , came across postgres thread (here) describe following error:
error: operator not exist: text = text[] hint: no operator matches given name , argument type(s). might need add explicit type casts. the error seems appear whenever array string type fed any without using = any. seems strange since based on language, logic, , sql conventions, have (e.g. in):
variable function(set)
instead of.
variable = function(set) , unless ofcourse operator summation/count operation returning 1 result :)
it make more senseto have variable any(set/array) instead of variable=any(set/array). similar example in function.
can explain going on here?
in (...) equivalent = (array[...])
crucially, any not function. it's syntax defined sql standard, , no more function group by or over clause in window function.
the reason = required before any any can apply other operators too. means "test operator left against every element in array on right, , return true if test true @ least 1 element."
you can use > (array[...]) or whatever. it's general purpose operator isn't restricted =. notably useful like any (albeit bad performance).
there all too, same thing returns true if results true.
Comments
Post a Comment