How can I cause a PL/pgSQL function to be executed from a SQL script?
I know how to invoke a function using a trigger, but I don’t know any other way.
I’m looking at the SQL Command Reference at http://www.postgresql.org/docs/7.4/static/sql-commands.html, but the only command that looks like a candidate to do this, namely EXECUTE, seems to use only the result of a PREPARE statement, which in turn can only accept a SELECT, INSERT, UPDATE, or DELETE statement as input, according to http://www.postgresql.org/docs/7.4/static/sql-prepare.html.
I’m not sure if I’m clearly saying what I need to do. I have a PL/pgSQL “foo (varchar)”. I have a script containing a bunch of DDL statements.
Somewhere in that script, I want to call or invoke (or whatever the right verb is) foo and provide its argument, so that when the script is being executed, at that point foo is executed and has its desired effect on the database. (I don’t need any return from foo.) But I don’t know what to put into the script to make this happen.
~ TIA
~ Ken