How to run a stored PL/pgSQL function?

From: "Ken Winter" <ken(at)sunward(dot)org>
To: "PostgreSQL pg-general List" <pgsql-general(at)postgresql(dot)org>
Subject: How to run a stored PL/pgSQL function?
Date: 2005-12-01 03:38:03
Message-ID: 004d01c5f628$a2ed1ba0$6603a8c0@kenxp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas F. O'Connell 2005-12-01 04:10:05 Re: SELECT Generating Row Exclusive Locks?
Previous Message Thomas F. O'Connell 2005-12-01 03:22:04 SELECT Generating Row Exclusive Locks?