Re: Skip ExecCheckRTPerms in CTAS with no data

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Skip ExecCheckRTPerms in CTAS with no data
Date: 2020-11-16 15:01:33
Message-ID: d049c272-9a47-d783-46b0-46665b011598@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-11-16 04:04, Michael Paquier wrote:
> On Fri, Nov 13, 2020 at 12:58:52PM +0530, Bharath Rupireddy wrote:
>> It's not required to set bistate to null as we have allocated myState
>> with palloc0 in CreateIntoRelDestReceiver, it will anyways be null.
>> if (!into->skipData)
>> myState->bistate = GetBulkInsertState();
>>
>> Attaching v4 patch. Please review it.
>
> I have reviewed this one this morning, and applied it after some
> tweaks. I have reworded some of the comments, fixed some typos, and
> largely refactored the test cases to stress all the combinations
> possible. Please note that your patch would have caused failures
> in the buildfarm, as any role created needs to be prefixed with
> "regress_".

While this patch was nice enough to update the documentation about the
requirement of the INSERT privilege, this is maybe more confusing now:
How could a new table not have INSERT privilege? Yes, you can do that
with default privileges, but that's not well known and should be
clarified in the documentation.

The SQL standard says that for CREATE TABLE AS, the INSERT "is
effectively executed without further Access Rule checking", which means
the INSERT privilege shouldn't be required at all. I suggest we
consider doing that instead. I don't see a use for the current behavior.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-11-16 15:06:00 Re: Move OpenSSL random under USE_OPENSSL_RANDOM
Previous Message Alvaro Herrera 2020-11-16 14:59:31 Re: Add important info about ANALYZE after create Functional Index