pgsql: Fix string_to_array() to correctly handle the case where there - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Fix string_to_array() to correctly handle the case where there
Date
Msg-id 20061007001159.B669B9FB43E@postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Fix string_to_array() to correctly handle the case where there are
overlapping possible matches for the separator string, such as
string_to_array('123xx456xxx789', 'xx').
Also, revise the logic of replace(), split_part(), and string_to_array()
to avoid O(N^2) work from redundant searches and conversions to pg_wchar
format when there are N matches to the separator string.
Backpatched the full patch as far as 8.0.  7.4 also has the bug, but the
code has diverged a lot, so I just went for a quick-and-dirty fix of the
bug itself in that branch.

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        varlena.c (r1.139.2.3 -> r1.139.2.4)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varlena.c.diff?r1=1.139.2.3&r2=1.139.2.4)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix string_to_array() to correctly handle the case where there
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix string_to_array() to correctly handle the case where there