Reputation: 2998
I need to write a C-function to extend my PostgreSQL server functionality. One of the arguments of that function is a string representing any PostgreSQL valid expression returning a number. For example:
and so on
The point is my function first replaces some values in the expression (variable names) for numbers and then it should execute the expression and returns the result (a number). With PL/pgSQL I can use EXECUTE expr INTO val, but how could I do it in a C function?
Many thanks in advance, and best regards
Upvotes: 1
Views: 354
Reputation: 62583
SPI_execute_with_args
sounds closer to what are you looking for. Check out the examples too.
Upvotes: 1