Re: Skip ExecCheckRTPerms in CTAS with no data
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>, Anastasia Lubennikova <a.lubennikova@postgrespro.ru>,
Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-11-20T09:21:30Z
Lists: pgsql-hackers
On Fri, Nov 20, 2020 at 12:59 PM Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote: > > On 2020-11-20 06:37, Michael Paquier wrote: > >>> But if you consider materialized views as a variant of normal views, > >>> then the INSERT privilege would be applicable if you pass an INSERT on > >>> the materialized view through to the underlying tables, like for a view. > > INSERT to materialized views is not supported, but perhaps you mean > > having a variant of auto updatable for matviews? I am not sure how to > > clearly define that. > > Not currently, but it could be a future feature. Basically an insert > would be passed on to the underlying tables (using INSTEAD triggers), > and then a refresh would be triggered automatically. > Sounds interesting! Just a thought: I think instead of just auto updating/refreshing materialized view for every single row inserted, maybe we could do it for a bunch of rows. If not with triggers, another way to achieve the auto updatable matviews functionality is by having a dedicated bgworker(which is by default switched off/not spawned). This worker can get the list of matviews and if the amount of rows changed in the underlying tables crosses a certain configurable limit, then refresh them using existing refresh matview infrastructure. Thoughts? With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Remove INSERT privilege check at table creation of CTAS and matview
- 878f3a19c6c8 14.0 landed
-
Relax INSERT privilege requirement for CTAS and matviews WITH NO DATA
- 846005e4f382 14.0 landed