Re: Function proposal to find the type of a datum - Mailing list pgsql-hackers

From Kate F
Subject Re: Function proposal to find the type of a datum
Date
Msg-id 20070202163244.GF390@cats.meow.at
Whole thread Raw
In response to Re: Function proposal to find the type of a datum  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Function proposal to find the type of a datum  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Feb/ 2/07 11:17:46AM -0500, Tom Lane wrote:
> Kate F <kate@cats.meow.at> writes:
> > (And whatever the decision regarding ANYELEMENT of, I believe this
> > should behave the same as IS OF)
> 
> In the light of morning I think it may be a non-problem.  The way that a
> plpgsql function with an ANYELEMENT parameter really works is that on
> first invocation with a parameter of a specific type, we generate a new
> parse-tree on the fly with the parameter being taken as of that type.
> So the IS OF or equivalent operation would never see ANYELEMENT, and
> there's nothing to "look through".  (You might check this by seeing if
> IS OF behaves sanely, before you go and spend time on a type_of function
> ...)

I have checked this - I mentioned earlier, when I spoke about my
discussion on IRC with Pavel, but had since forgotten! IS OF for an
array of TEXT yields TEXT. I think this is convenient behaviour
(likewise for the function I'm proposing).

So, to conclude, we still have a valid use-case (which you explained a
little more explicitly than I did). Shall I attempt to implement it?
(that is, type_name_of() which returns TEXT)

Regards,

-- 
Kate


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Function proposal to find the type of a datum
Next
From: "Pavel Stehule"
Date:
Subject: proposal: only superuser can change customized_options