Question

I have a table with two enum columns, each enum contains 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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top