From 81729dcf39992f27f416f8c293fafbdbd0ad6d2c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 8 Aug 2016 20:28:27 +0100 Subject: Update string literals in regex to behave predictably regardless of standard_conforming_strings --- gentoobrowse-api/db/schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gentoobrowse-api/db/schema.sql b/gentoobrowse-api/db/schema.sql index f9bf489..d4bbce6 100644 --- a/gentoobrowse-api/db/schema.sql +++ b/gentoobrowse-api/db/schema.sql @@ -69,7 +69,7 @@ CREATE FUNCTION bugpackages(b bugs) RETURNS text[] LANGUAGE plpgsql IMMUTABLE AS $$ BEGIN - RETURN ARRAY_AGG(p[1]) FROM REGEXP_MATCHES(b.summary, '([[:alnum:]-]+/[[:alnum:]_-]+?)(?:-(?:[0-9][.0-9]*[[:alpha:]]?\*?(?:(?:_(?:alpha|beta|pre|rc|p))?[[:digit:]]*)*(?:-r[[:digit:]]+)?))?', 'g') p; + RETURN ARRAY_AGG(p[1]) FROM REGEXP_MATCHES(b.summary, E'([[:alnum:]-]+/[[:alnum:]_-]+?)(?:-(?:[0-9][.0-9]*[[:alpha:]]?\\*?(?:(?:_(?:alpha|beta|pre|rc|p))?[[:digit:]]*)*(?:-r[[:digit:]]+)?))?', 'g') p; END $$; ALTER FUNCTION gentoobrowse.bugpackages(b bugs) OWNER TO gentoo; @@ -97,7 +97,7 @@ CREATE FUNCTION textclean(t text) RETURNS text LANGUAGE plpgsql IMMUTABLE AS $$ BEGIN - RETURN TRIM(REGEXP_REPLACE(t, '\s+', ' ', 'g')); + RETURN TRIM(REGEXP_REPLACE(t, E'\\s+', ' ', 'g')); END $$; ALTER FUNCTION gentoobrowse.textclean(t text) OWNER TO gentoo; -- cgit v1.2.3