pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix RLS with COPY (col1, col2) FROM tab
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix RLS with COPY (col1, col2) FROM tab
@ 2016-10-03 20:24  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Stephen Frost @ 2016-10-03 20:24 UTC (permalink / raw)
  To: 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
------
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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix RLS with COPY (col1, col2) FROM tab
@ 2016-10-03 20:24  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Stephen Frost @ 2016-10-03 20:24 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix RLS with COPY (col1, col2) FROM tab
@ 2016-10-03 20:24  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Stephen Frost @ 2016-10-03 20:24 UTC (permalink / raw)
  To: 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_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/647a86e374d2eb01d8cdda2fc759a770b38cc232

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-10-03 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 20:24 pgsql: Fix RLS with COPY (col1, col2) FROM tab Stephen Frost <sfrost@snowman.net>
2016-10-03 20:24 pgsql: Fix RLS with COPY (col1, col2) FROM tab Stephen Frost <sfrost@snowman.net>
2016-10-03 20:24 pgsql: Fix RLS with COPY (col1, col2) FROM tab Stephen Frost <sfrost@snowman.net>

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