Re: Run procedure at startup

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Saleem EDAH-TALLY <nmset(at)netcourrier(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Run procedure at startup
Date: 2009-07-27 16:14:46
Message-ID: 4A6DD276.4010609@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Saleem EDAH-TALLY wrote:
> Is there a way to run a pl/pgsql automatically at server startup ?

in your postgres startup script launch a session with `psql ... -c "some
sql commands"` or `psql ... -f somescript.sql` ...

> Is there a way to run a pl/pgsql function with an infinite loop as a
> daemon ?

functions are called from within a transaction. if you did this, that
transaction would never end, and this would prevent VACUUM from cleaning
up any freed tuples from newer than the start of that transaction. Not
good. you could, however, have a system daemon that periodically
invokes a plpgsql function.

> Is there a way to start a pl/pgsql function that would persist after
> the user session has closed ?

no.

> Is there a way for an unprivileged user to delegate a task (allowed by
> superuser) to a superuser ?

someone else will have to chime in here.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexey Klyukin 2009-07-27 16:28:16 Re: Calculating the difference between timetz values
Previous Message Pavel Stehule 2009-07-27 16:10:45 Re: Run procedure at startup