Re: Run procedure at startup - Mailing list pgsql-general

From John R Pierce
Subject Re: Run procedure at startup
Date
Msg-id 4A6DD276.4010609@hogranch.com
Whole thread Raw
In response to Run procedure at startup  ("Saleem EDAH-TALLY" <nmset@netcourrier.com>)
List 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.



pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Run procedure at startup
Next
From: Alexey Klyukin
Date:
Subject: Re: Calculating the difference between timetz values