pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons
@ 2015-02-16 04:27 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-02-16 04:27 UTC (permalink / raw)
  To: pgsql-committers

Fix null-pointer-deref crash while doing COPY IN with check constraints.

In commit bf7ca15875988a88e97302e012d7c4808bef3ea9 I introduced an
assumption that an RTE referenced by a whole-row Var must have a valid eref
field.  This is false for RTEs constructed by DoCopy, and there are other
places taking similar shortcuts.  Perhaps we should make all those places
go through addRangeTableEntryForRelation or its siblings instead of having
ad-hoc logic, but the most reliable fix seems to be to make the new code in
ExecEvalWholeRowVar cope if there's no eref.  We can reasonably assume that
there's no need to insert column aliases if no aliases were provided.

Add a regression test case covering this, and also verifying that a sane
column name is in fact available in this situation.

Although the known case only crashes in 9.4 and HEAD, it seems prudent to
back-patch the code change to 9.2, since all the ingredients for a similar
failure exist in the variant patch applied to 9.3 and 9.2.

Per report from Jean-Pierre Pelletier.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/08361cea2b333189fa3736f2dc6452cef654923d

Modified Files
--------------
src/backend/executor/execQual.c     |    7 +++++--
src/test/regress/expected/copy2.out |   34 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql      |   19 +++++++++++++++++++
3 files changed, 58 insertions(+), 2 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: Fix null-pointer-deref crash while doing COPY IN with check cons
@ 2015-02-16 04:27 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-02-16 04:27 UTC (permalink / raw)
  To: pgsql-committers

Fix null-pointer-deref crash while doing COPY IN with check constraints.

In commit bf7ca15875988a88e97302e012d7c4808bef3ea9 I introduced an
assumption that an RTE referenced by a whole-row Var must have a valid eref
field.  This is false for RTEs constructed by DoCopy, and there are other
places taking similar shortcuts.  Perhaps we should make all those places
go through addRangeTableEntryForRelation or its siblings instead of having
ad-hoc logic, but the most reliable fix seems to be to make the new code in
ExecEvalWholeRowVar cope if there's no eref.  We can reasonably assume that
there's no need to insert column aliases if no aliases were provided.

Add a regression test case covering this, and also verifying that a sane
column name is in fact available in this situation.

Although the known case only crashes in 9.4 and HEAD, it seems prudent to
back-patch the code change to 9.2, since all the ingredients for a similar
failure exist in the variant patch applied to 9.3 and 9.2.

Per report from Jean-Pierre Pelletier.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1bf32972e6daf91329ceacca80e5ba67068882bb

Modified Files
--------------
src/backend/executor/execQual.c     |    7 +++++--
src/test/regress/expected/copy2.out |   34 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql      |   19 +++++++++++++++++++
3 files changed, 58 insertions(+), 2 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: Fix null-pointer-deref crash while doing COPY IN with check cons
@ 2015-02-16 04:27 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-02-16 04:27 UTC (permalink / raw)
  To: pgsql-committers

Fix null-pointer-deref crash while doing COPY IN with check constraints.

In commit bf7ca15875988a88e97302e012d7c4808bef3ea9 I introduced an
assumption that an RTE referenced by a whole-row Var must have a valid eref
field.  This is false for RTEs constructed by DoCopy, and there are other
places taking similar shortcuts.  Perhaps we should make all those places
go through addRangeTableEntryForRelation or its siblings instead of having
ad-hoc logic, but the most reliable fix seems to be to make the new code in
ExecEvalWholeRowVar cope if there's no eref.  We can reasonably assume that
there's no need to insert column aliases if no aliases were provided.

Add a regression test case covering this, and also verifying that a sane
column name is in fact available in this situation.

Although the known case only crashes in 9.4 and HEAD, it seems prudent to
back-patch the code change to 9.2, since all the ingredients for a similar
failure exist in the variant patch applied to 9.3 and 9.2.

Per report from Jean-Pierre Pelletier.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4662ba5a23db39b695050afbcc5ff65ccd285179

Modified Files
--------------
src/backend/executor/execQual.c     |    7 +++++--
src/test/regress/expected/copy2.out |   35 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql      |   19 +++++++++++++++++++
3 files changed, 59 insertions(+), 2 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: Fix null-pointer-deref crash while doing COPY IN with check cons
@ 2015-02-16 04:27 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-02-16 04:27 UTC (permalink / raw)
  To: pgsql-committers

Fix null-pointer-deref crash while doing COPY IN with check constraints.

In commit bf7ca15875988a88e97302e012d7c4808bef3ea9 I introduced an
assumption that an RTE referenced by a whole-row Var must have a valid eref
field.  This is false for RTEs constructed by DoCopy, and there are other
places taking similar shortcuts.  Perhaps we should make all those places
go through addRangeTableEntryForRelation or its siblings instead of having
ad-hoc logic, but the most reliable fix seems to be to make the new code in
ExecEvalWholeRowVar cope if there's no eref.  We can reasonably assume that
there's no need to insert column aliases if no aliases were provided.

Add a regression test case covering this, and also verifying that a sane
column name is in fact available in this situation.

Although the known case only crashes in 9.4 and HEAD, it seems prudent to
back-patch the code change to 9.2, since all the ingredients for a similar
failure exist in the variant patch applied to 9.3 and 9.2.

Per report from Jean-Pierre Pelletier.

Branch
------
REL9_2_STABLE

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

Modified Files
--------------
src/backend/executor/execQual.c     |    7 +++++--
src/test/regress/expected/copy2.out |   35 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql      |   17 +++++++++++++++++
3 files changed, 57 insertions(+), 2 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-02-16 04:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 04:27 pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons Tom Lane <tgl@sss.pgh.pa.us>
2015-02-16 04:27 pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons Tom Lane <tgl@sss.pgh.pa.us>
2015-02-16 04:27 pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons Tom Lane <tgl@sss.pgh.pa.us>
2015-02-16 04:27 pgsql: Fix null-pointer-deref crash while doing COPY IN with check cons Tom Lane <tgl@sss.pgh.pa.us>

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