From: Stephen Frost <sfrost@snowman.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix RLS with COPY (col1, col2) FROM tab
Date: Mon, 03 Oct 2016 20:24:12 +0000
Message-ID: <E1br9mW-0005C8-DW@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Fix RLS with COPY (col1, col2) FROM tab
Attempting to COPY a subset of columns from a table with RLS enabled
would fail due to an invalid query being constructed (using a single
ColumnRef with the list of fields to exact in 'fields', but that's for
the different levels of an indirection for a single column, not for
specifying multiple columns).
Correct by building a ColumnRef and then RestTarget for each column
being requested and then adding those to the targetList for the select
query. Include regression tests to hopefully catch if this is broken
again in the future.
Patch-By: Adam Brightwell
Reviewed-By: Michael Paquier
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/814b9e9b8edf36cac65e0d8fcef17e50a04b1617
Modified Files
--------------
src/backend/commands/copy.c | 63 ++++++++++++++++++++++++------
src/test/regress/expected/copy2.out | 78 +++++++++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql | 63 ++++++++++++++++++++++++++++++
3 files changed, 192 insertions(+), 12 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: sfrost@snowman.net
Subject: Re: pgsql: Fix RLS with COPY (col1, col2) FROM tab
In-Reply-To: <E1br9mW-0005C8-DW@gemulon.postgresql.org>
References: <E1br9mW-0005C8-DW@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox