On Fri, Feb/ 2/07 02:17:51AM -0500, Tom Lane wrote: > "Pavel Stehule" <[EMAIL PROTECTED]> writes: > > you can identify type via operator OF. > > > IF a IS OF INTEGER THEN > > RAISE NOTICE 'Parametr a is numeric'; > > Yeah, that is the SQL-standard syntax, but I think our implementation > doesn't work the way Kate would like: if "a" is an ANYELEMENT function > parameter then (I think) only IS OF ANYELEMENT would succeed. Would it > conform to the SQL spec for the test to "look through" ANYELEMENT to the > actual parameter type? Would it be reasonably implementable to do that?
Well, actually, I discussed this on IRC with Pavel, and for the above I have syntax error at or near "INTEGER". My guess was that the grammar changed as an unintentional side-effect of some other change. He corrected his suggestion: OF takes a list of types; it needs parentheses: IF a IS OF (INTEGER) THEN This operator would look wonderful for my particular needs, were it not that it has completely different semantics! It appears to test to see what a datum actually *is* (in my case TEXT), rather than what it may be parsed as (in my case, INTEGER). Meanwhile, I still think the function David proposed is a worthy addition (and I still have a user-case for it!), as using just the OF operator for something similar, one would have to explictly test against every type required. Thank you, -- Kate ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster