pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make viewquery a copy in rewriteTargetView()
4+ messages / 1 participants
[nested] [flat]

* pgsql: Make viewquery a copy in rewriteTargetView()
@ 2015-12-21 15:35  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Stephen Frost @ 2015-12-21 15:35 UTC (permalink / raw)
  To: pgsql-committers

Make viewquery a copy in rewriteTargetView()

Rather than expect the Query returned by get_view_query() to be
read-only and then copy bits and pieces of it out, simply copy the
entire structure when we get it.  This addresses an issue where
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),
scribbles on the parsetree passed in, which was actually an entry
in relcache, leading to segfaults with certain view definitions.
This also future-proofs us a bit for anyone adding more code to this
path.

The acquireLocksOnSubLinks() was added in commit c3e0ddd40.

Back-patch to 9.3 as that commit was.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4271ed3860e3885d3fbed1ea9ee4f058e8763104

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c          |   29 +++++++----
src/test/regress/expected/updatable_views.out |   67 +++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql      |   44 ++++++++++++++++
3 files changed, 130 insertions(+), 10 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] 4+ messages in thread

* pgsql: Make viewquery a copy in rewriteTargetView()
@ 2015-12-21 15:35  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Stephen Frost @ 2015-12-21 15:35 UTC (permalink / raw)
  To: pgsql-committers

Make viewquery a copy in rewriteTargetView()

Rather than expect the Query returned by get_view_query() to be
read-only and then copy bits and pieces of it out, simply copy the
entire structure when we get it.  This addresses an issue where
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),
scribbles on the parsetree passed in, which was actually an entry
in relcache, leading to segfaults with certain view definitions.
This also future-proofs us a bit for anyone adding more code to this
path.

The acquireLocksOnSubLinks() was added in commit c3e0ddd40.

Back-patch to 9.3 as that commit was.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/496943ec2b6de0f22cd9e18f673e13635b5972ef

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c          |   34 ++++++++-----
src/test/regress/expected/updatable_views.out |   67 +++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql      |   44 ++++++++++++++++
3 files changed, 133 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] 4+ messages in thread

* pgsql: Make viewquery a copy in rewriteTargetView()
@ 2015-12-21 15:35  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Stephen Frost @ 2015-12-21 15:35 UTC (permalink / raw)
  To: pgsql-committers

Make viewquery a copy in rewriteTargetView()

Rather than expect the Query returned by get_view_query() to be
read-only and then copy bits and pieces of it out, simply copy the
entire structure when we get it.  This addresses an issue where
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),
scribbles on the parsetree passed in, which was actually an entry
in relcache, leading to segfaults with certain view definitions.
This also future-proofs us a bit for anyone adding more code to this
path.

The acquireLocksOnSubLinks() was added in commit c3e0ddd40.

Back-patch to 9.3 as that commit was.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f02137da88c49125a20d7c51ae9932e47eb61f93

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c          |   34 ++++++++-----
src/test/regress/expected/updatable_views.out |   67 +++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql      |   44 ++++++++++++++++
3 files changed, 133 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] 4+ messages in thread

* pgsql: Make viewquery a copy in rewriteTargetView()
@ 2015-12-21 15:35  Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Stephen Frost @ 2015-12-21 15:35 UTC (permalink / raw)
  To: pgsql-committers

Make viewquery a copy in rewriteTargetView()

Rather than expect the Query returned by get_view_query() to be
read-only and then copy bits and pieces of it out, simply copy the
entire structure when we get it.  This addresses an issue where
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),
scribbles on the parsetree passed in, which was actually an entry
in relcache, leading to segfaults with certain view definitions.
This also future-proofs us a bit for anyone adding more code to this
path.

The acquireLocksOnSubLinks() was added in commit c3e0ddd40.

Back-patch to 9.3 as that commit was.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6f8cb1e23485bd6d45e8865760436e1a5ce65a6d

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c          |   34 ++++++++-----
src/test/regress/expected/updatable_views.out |   67 +++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql      |   44 ++++++++++++++++
3 files changed, 133 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] 4+ messages in thread


end of thread, other threads:[~2015-12-21 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 15:35 pgsql: Make viewquery a copy in rewriteTargetView() Stephen Frost <sfrost@snowman.net>
2015-12-21 15:35 pgsql: Make viewquery a copy in rewriteTargetView() Stephen Frost <sfrost@snowman.net>
2015-12-21 15:35 pgsql: Make viewquery a copy in rewriteTargetView() Stephen Frost <sfrost@snowman.net>
2015-12-21 15:35 pgsql: Make viewquery a copy in rewriteTargetView() 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