开发者

Is there a way to call a function by its oid in postgresql?

开发者 https://www.devze.com 2023-04-01 19:03 出处:网络
I have a table with two enum columns, each enum contain开发者_开发技巧s about 10 possible values.

I have a table with two enum columns, each enum contain开发者_开发技巧s about 10 possible values. I need to write a function that calls a specific other function for each row of this table, depending on the particular combination of these values in the row. I don't want to create a 10x10 (=100) "WHEN"s and cases, what I want to do is to make a table that contains the combinations and the oids of correspoding functions. I even managed to do it, but now I don't know how to call the functions. Any help would be appreciated.


You can't call a function by it's oid. But you can of course get the functions name from the oid, and then construct a dynamic SQL statement and run it with EXECUTE in pl/pgsql.

0

精彩评论

暂无评论...
验证码 换一张
取 消