pgsql: Fix overly-strict assertions in spgtextproc.c.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix overly-strict assertions in spgtextproc.c.
Date: 2016-01-02 21:25:39
Message-ID: E1aFTgB-0001hF-Ae@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix overly-strict assertions in spgtextproc.c.

spg_text_inner_consistent is capable of reconstructing an empty string
to pass down to the next index level; this happens if we have an empty
string coming in, no prefix, and a dummy node label. (In practice, what
is needed to trigger that is insertion of a whole bunch of empty-string
values.) Then, we will arrive at the next level with in->level == 0
and a non-NULL (but zero length) in->reconstructedValue, which is valid
but the Assert tests weren't expecting it.

Per report from Andreas Seltenreich. This has no impact in non-Assert
builds, so should not be a problem in production, but back-patch to
all affected branches anyway.

In passing, remove a couple of useless variable initializations and
shorten the code by not duplicating DatumGetPointer() calls.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7157fe80f42476db249e062b4f6eef6a3994b234

Modified Files
--------------
src/backend/access/spgist/spgtextproc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-01-03 00:05:11 pgsql: Teach pg_dump to quote reloption values safely.
Previous Message Tom Lane 2016-01-02 20:29:26 pgsql: Adjust back-branch release note description of commits a2a718b22