Re: COPY command with RLS bug

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Adam Brightwell <adam(dot)brightwell(at)crunchydata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY command with RLS bug
Date: 2016-09-09 07:19:36
Message-ID: CANP8+jL_q02yODTOzJuSudffsVMYhbR1Y3McWfPJCspf5WA1VA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8 September 2016 at 20:13, Adam Brightwell
<adam(dot)brightwell(at)crunchydata(dot)com> wrote:

> I have discovered a bug with the COPY command, specifically related to RLS.
...
> Connecting as a non-privileged user provides the following results:
...
> COPY foo (a, b, c) TO stdout; -- fail
> ERROR: missing FROM-clause entry for table "b"
> LINE 1: copy foo (a, b, c) to stdout;
...
> The issue seems to be that the target list for the resulting SELECT
> statement is not being built correctly. I have attached a proposed
> patch to fix this issue. As well, I have added a few regression tests
> for this case.

Thanks for the report and the fix.

This seems a rather basic error to occur a year after release.

Is this a problem with the testing of RLS? What other RLS related
failures exist in other commands?

Perhaps we should extend rowsecurity test with a more comprehensive
set of tests rather than just fix the COPY one?

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim Gündüz 2016-09-09 08:02:15 Re: ICU integration
Previous Message Masahiko Sawada 2016-09-09 07:04:15 Re: Vacuum: allow usage of more than 1GB of work mem