From: Anton Maksimenkov <engineer@hlebprom.ru>
To: pgsql-admin@postgresql.org
Subject: opportunities of inline funtions
Date: Thu, 28 Oct 2004 10:18:24 +0600
Message-ID: <41807310.8050009@hlebprom.ru> (raw)
Hi.
There was an idea to make access to the data only through the built - in
functions (on C). There is a table 't_test' which the superuser can read and
write down. There are functions of access, for example, for an insert of the
data:
PG_FUNCTION_INFO_V1(f_test);
Datum
f_test(PG_FUNCTION_ARGS)
{
int ret, proc;
SPI_connect();
ret = SPI_exec("INSERT INTO t_test VALUES ('7', 'hi there')", 0);
proc = SPI_processed;
SPI_finish();
return (proc);
}
It is supposed further, that function will check the data and to carry out
something else, unimportantly. And so. It would be desirable, that this
function was carried out by the usual user, and it could work "as" superuser.
That is has executed an insert of the data. Read caution about "trojan horses"
in functions which allow the usual user to get access to the data which are
inaccessible to him. Here is how this idea I wanted to apply time in positive
sense. So I grant execute of this function to 'testo' user
=> GRANT EXECUTE ON FUNCTION f_test(INT, CHAR) TO testo;
However I receive a mistake
=> SELECT f_test('1','2');
ERROR: t_test: permission denied
How to realize this idea?
--
engineer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: engineer@hlebprom.ru
Subject: Re: opportunities of inline funtions
In-Reply-To: <41807310.8050009@hlebprom.ru>
References: <41807310.8050009@hlebprom.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox