From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix RLS with COPY (col1, col2) FROM tab |
Date: | 2016-10-03 20:24:12 |
Message-ID: | E1br9mW-0005CA-Da@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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
------
REL9_6_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/190765a059cc5e8226cdb18b9715741b32b12255
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-10-03 20:40:41 | pgsql: Show a sensible value in pg_settings.unit for GUC_UNIT_XSEGS var |
Previous Message | Robert Haas | 2016-10-03 19:43:33 | Re: [COMMITTERS] pgsql: Copy-editing for contrib/pg_visibility documentation. |