Re: AW: Why is materialized view creation a "security-restricted operation"?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Färber, Franz-Josef (StMUK) <Franz-Josef(dot)Faerber(at)stmuk(dot)bayern(dot)de>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: "Haupt, Matthias (StMUK)" <Matthias(dot)Haupt(at)stmuk(dot)bayern(dot)de>
Subject: Re: AW: Why is materialized view creation a "security-restricted operation"?
Date: 2026-10-13 16:48:24
Message-ID: e7b5d9c1-b1ad-47a3-b604-5ae9652881f1@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/13/26 9:23 AM, Adrian Klaver wrote:
> On 10/13/26 4:36 AM, Färber, Franz-Josef (StMUK) wrote:
>>>> [rant about PostgreSQL security restrictions]
>> No no no, not about security restrictions. The rant is about lacking
>> orthogonality. About often NOT being able to combine language
>> features. Doesn't anybody share that view? We COULD do better, I think.
>
> Quick and dirty example.
>
> cat test.csv
> 1,dog,t
> 2,cat,f
> 3,fish,t
>
> CREATE OR REPLACE FUNCTION public.temp_table()

Forgive the function name, it was created before I realized I was not
really going with a temporary table.

>  RETURNS TABLE(id integer, type character varying, active boolean)
>  LANGUAGE plpgsql
> AS $function$
> BEGIN
>     DROP TABLE IF EXISTS test_csv;
>     CREATE TABLE test_csv(id integer, type varchar, active boolean);
>     COPY test_csv FROM '/var/lib/postgresql/18/main/test.csv' WITH CSV;
>     RETURN QUERY EXECUTE
>         'SELECT id, type, active FROM test_csv';
> END;
> $function$
>
>
> select * from temp_table();
>  id | type | active
> ----+------+--------
>   1 | dog  | t
>   2 | cat  | f
>   3 | fish | t
>
>
>>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Álvaro Herrera 2026-10-13 18:53:34 Re: pg_event_trigger_ddl_commands after GRANT is quite empty
Previous Message Adrian Klaver 2026-10-13 16:23:19 Re: AW: Why is materialized view creation a "security-restricted operation"?