X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 70B203A3D47 for ; Thu, 28 Oct 2004 05:18:15 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22424-02 for ; Thu, 28 Oct 2004 04:18:05 +0000 (GMT) Received: from gw7.hlebprom.ru (unknown [62.148.250.13]) by svr1.postgresql.org (Postfix) with ESMTP id 1B1533A47E6 for ; Thu, 28 Oct 2004 05:18:02 +0100 (BST) Received: from hlebprom.ru (openbox.hlebprom.ru [172.16.7.7]) by gw7.hlebprom.ru (Postfix) with ESMTP id 3CCC54B7FC for ; Thu, 28 Oct 2004 10:18:20 +0600 (YEKST) Message-ID: <41807310.8050009@hlebprom.ru> Date: Thu, 28 Oct 2004 10:18:24 +0600 From: Anton Maksimenkov Reply-To: engineer@hlebprom.ru User-Agent: Mozilla Thunderbird 0.5 (X11/20040912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: opportunities of inline funtions Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/355 X-Sequence-Number: 15348 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