Getting the oid of an anyelement

From: Scott Bailey <artacus(at)comcast(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Getting the oid of an anyelement
Date: 2009-09-10 18:28:13
Message-ID: 4AA9453D.8010801@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I've got a function (sql or plpgsql) that takes anyelement as a
param, how do I determine the type name or oid that was actually passed
in? I figure there is probably a function for this but darn if I can
find it.

Specifically, I'm trying to make a function like Oracle's dump that will
take anything as input and return the internal representation of it. So
I want to determine what type was passed in and call the appropriate
send function.

SELECT dump(current_date);

dump
------------------------------------------
Type=date OID=1082 Len=4 Data=(0,0,13,212)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Headland 2009-09-10 18:28:31 Re: COPY command character set
Previous Message Tom Lane 2009-09-10 18:12:55 Re: COPY command character set