Re: Triggers & Compiled C Language Functions - Mailing list pgsql-novice

From Tom Lane
Subject Re: Triggers & Compiled C Language Functions
Date
Msg-id 28259.1006236315@sss.pgh.pa.us
Whole thread Raw
In response to Triggers & Compiled C Language Functions  (Andrew Burr <andrew.burr@level3.com>)
List pgsql-novice
Andrew Burr <andrew.burr@level3.com> writes:
> What are all the security restrictions on stored procedures and compiled
> C language functions?

A C-coded function can do any durn thing you feel like programming;
there are no (and can't be any, AFAICS) security restrictions on it.

You should, however, think twice about how the external interactions
you intend will interact with Postgres' transaction model.  Some
questions: if the transaction that called your function later gets
rolled back, would you wish that the external call had not been made?
If two different transactions invoke the C function, will it bother
you if the database thinks that transaction A logically precedes
transaction B even though the call order of the C function was B
before A?  What if one of the two transactions later rolls back,
but the other still wants to commit?

It's real easy to shoot yourself in the foot in this realm.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Gyozo Papp"
Date:
Subject: Re: [PHP] psql with PHP question
Next
From: Colin Barnard
Date:
Subject: Re: Migrating db from Oracle to Postgresql