Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Pavel Stehule
2009/9/10 Scott Bailey : >> please, try to look on function pg_typeof > > Thanks Pavel. Just what I needed. But you're too late on the orafce > recommendation. I had already written it by the time you posted. I would > have written it any way though because Tom said I couldn't :) > >> You would nee

Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Scott Bailey
please, try to look on function pg_typeof Thanks Pavel. Just what I needed. But you're too late on the orafce recommendation. I had already written it by the time you posted. I would have written it any way though because Tom said I couldn't :) You would need to write that in C. Two probl

Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Pavel Stehule
2009/9/10 Tom Lane : > Scott Bailey writes: >> 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. > > You would

Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Tom Lane
Scott Bailey writes: > 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. You would need to write that in C.

Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Pavel Stehule
Hello please, try to look on function pg_typeof postgres=# CREATE OR REPLACE FUNCTION x(anyelement) RETURNS oid AS $$ SELECT pg_typeof($1)::oid; $$ LANGUAGE sql; CREATE FUNCTION postgres=# select x(10); x 23 (1 row) postgres=# select x(current_date); x -- 1082 (1 row) postgres=#

[GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Scott Bailey
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 tak