* Stephen Frost (sfr...@snowman.net) wrote:
> Attached are two test scripts and results from them.  The gist of it is
> this:

Now with the attachements.  Apologies about that.  Note that you'll need
to create the temp tablespace first.

        Thanks,

                Stephen

Attachment: test_tblspace.sql
Description: application/sql

Attachment: test_tblspace2.sql
Description: application/sql

 current_user 
--------------
 sfrost
(1 row)

 role 
------
 none
(1 row)

 temp_tablespaces 
------------------
 rn_temp_01
(1 row)

                                        List of tablespaces
    Name    | Owner  |                 Location                  | Access 
privileges | Description 
------------+--------+-------------------------------------------+-------------------+-------------
 rn_temp_01 | sfrost | /var/lib/postgresql/rn_tblspcs/rn_temp_01 |              
     | 
(1 row)

create temporary table test1 (a int);
CREATE TABLE

select relname,reltablespace from pg_class where relname = test1;
 relname | reltablespace 
---------+---------------
 test1   |         36578
(1 row)

drop role if exists test_role;
DROP ROLE
create role test_role;
CREATE ROLE
set role test_role;
SET
create temporary table test3 (a int);
ERROR:  permission denied for tablespace rn_temp_01
 current_user 
--------------
 sfrost
(1 row)

 role 
------
 none
(1 row)

 temp_tablespaces 
------------------
 rn_temp_01
(1 row)

                                        List of tablespaces
    Name    | Owner  |                 Location                  | Access 
privileges | Description 
------------+--------+-------------------------------------------+-------------------+-------------
 rn_temp_01 | sfrost | /var/lib/postgresql/rn_tblspcs/rn_temp_01 |              
     | 
(1 row)

create function test_func () returns int language plpgsql security definer as 
begin create temporary table test2 (a int); return 1; end;;
CREATE FUNCTION
                                                                                
List of functions
 Schema |   Name    | Result data type | Argument data types |  Type  | 
Volatility | Owner  | Language |                        Source code             
            | Description 
--------+-----------+------------------+---------------------+--------+------------+--------+----------+------------------------------------------------------------+-------------
 public | test_func | integer          |                     | normal | 
volatile   | sfrost | plpgsql  | begin create temporary table test2 (a int); 
return 1; end; | 
(1 row)

drop role if exists test_role;
DROP ROLE
create role test_role;
CREATE ROLE
set role test_role;
SET
create temporary table test (a int);
CREATE TABLE
 relname | reltablespace 
---------+---------------
 test    |             0
(1 row)

 test_func 
-----------
         1
(1 row)

 relname | reltablespace 
---------+---------------
 test2   |             0
(1 row)

Attachment: signature.asc
Description: Digital signature

Reply via email to