Skip site navigation (1) Skip section navigation (2)

pgsql: Make bit/varbit substring() treat any negative length as meaning

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make bit/varbit substring() treat any negative length as meaning
Date: 2010-01-07 19:53:11
Message-ID: 20100107195311.7C4017541B9@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Make bit/varbit substring() treat any negative length as meaning "all the rest
of the string".  The previous coding treated only -1 that way, and would
produce an invalid result value for other negative values.

We ought to fix it so that 2-parameter bit substring() is a different C
function and the 3-parameter form throws error for negative length, but
that takes a pg_proc change which is impractical in the back branches;
and in any case somebody might be relying on -1 working this way.
So just do this as a back-patchable fix.

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        varbit.c (r1.61 -> r1.62)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varbit.c?r1=1.61&r2=1.62)

pgsql-committers by date

Next:From: Tom LaneDate: 2010-01-07 19:53:16
Subject: pgsql: Make bit/varbit substring() treat any negative length as meaning
Previous:From: Tom LaneDate: 2010-01-07 16:29:58
Subject: pgsql: Fix (some of the) breakage introduced into query-cancel

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group