By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

SRF question

P: n/a
Hi everyone.

I need to create a C function that returns a row, and the type of this
row must be the same of a type that I've created using CREATE TYPE.

I've seen the function:
TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases)
but I don't understand two things:

1)I just know the name of the type, not its oid... woud it be ok if I
execute a SELECT on pg_type asking for typname to find the oid of the
type I want to return? or is there any function like
RelationNameGetTupleDesc (maybe TypeNameGetTupleDesc) that I can call
passing just the typename as a char *?

2)in case TypeGetTupleDesc is the only option, what is the second
argument?

Thanks in advance.

PS: sorry if you receive this message twice, I sent it on saturday but
it seems it never arrived :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQA/XJBy21dVnhLsBV0RAr5rAJ4pPNKPtCIDw44TzgnuBV2/JLy/5wCeOerZ
/vuGW6dUC5rrIX0kz4w/7Lg=
=81wm
-----END PGP SIGNATURE-----

Nov 11 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Franco Bruno Borghesi <fr****@akyasociados.com.ar> writes:
1)I just know the name of the type, not its oid... woud it be ok if I
execute a SELECT on pg_type asking for typname to find the oid of the
type I want to return? or is there any function like
RelationNameGetTupleDesc (maybe TypeNameGetTupleDesc) that I can call
passing just the typename as a char *?
A SELECT seems like the hard way. Look into parse_type.c for some
routines that might help. Offhand parseTypeString() is probably your
best bet.
2)in case TypeGetTupleDesc is the only option, what is the second
argument?


I believe you can just set it to NIL, since you are only interested in
composite types.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #2

P: n/a
yes, parseTypeString() seems to be the way.

I've found parseTypeString() in plpgsql.so... would it be ok to call
dlopen('plpgsql.so', ...) from my C code to access this function or is
there some other method I sould use?

thanks tom.

On Mon, 2003-09-08 at 12:02, Tom Lane wrote:
Franco Bruno Borghesi <fr****@akyasociados.com.ar> writes:
1)I just know the name of the type, not its oid... woud it be ok if I
execute a SELECT on pg_type asking for typname to find the oid of the
type I want to return? or is there any function like
RelationNameGetTupleDesc (maybe TypeNameGetTupleDesc) that I can call
passing just the typename as a char *?


A SELECT seems like the hard way. Look into parse_type.c for some
routines that might help. Offhand parseTypeString() is probably your
best bet.
2)in case TypeGetTupleDesc is the only option, what is the second
argument?


I believe you can just set it to NIL, since you are only interested in
composite types.

regards, tom lane


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQA/XMED21dVnhLsBV0RAsD3AKCN2yMnGUI/Hfo4Ha0uR1wK98IvrwCfQGRi
hDcXtHWoU8EDxmbOupaCAHM=
=3Kkl
-----END PGP SIGNATURE-----

Nov 11 '05 #3

P: n/a
Franco Bruno Borghesi <fr****@akyasociados.com.ar> writes:
I've found parseTypeString() in plpgsql.so... would it be ok to call
dlopen('plpgsql.so', ...) from my C code to access this function


Why would you need to do that!??! It's in the main executable.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 11 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.