On 1/23/17 1:36 PM, Tom Lane wrote:
Is there a way for a function in an extension to find the OID of one of its sibling functions?
Obviously there's regprocedure (or it's C equivalent), but then you're stuck re-computing at runtime. I've messed around with that a bit in an effort to have an extension depend on another extension that allows the user to specify it's schema. If you're already doing metaprogramming it's not an enormous problem... if you're not already doing that it sucks. Trying to make that work in C would be somewhere between impossible and a nightmare.
Since this kind of thing affects extensions that depend on extensions, it'd certainly be nice if there was some way to address it.
BTW, I actually do use SPI to call one of the reg casts in my variant type, but that's just a hack I used in the beginning and haven't gotten around to replacing. Since there's a static variable that gets set to the relevant OID it's not that bad performance-wise from what I can tell, but I suspect that's not something we want to be recommending to others...
-- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers