Frank Kobzik has uploaded a new change for review.

Change subject: core: Fix splitting logic for ip addresses
......................................................................

core: Fix splitting logic for ip addresses

This patch fixes the stored procedure responsible for splitting if
addresses string to array.

The problem reproduced when function received string of whitespaces or
list of more than one ip addresses (the list wasn't correctly split
and caused errors with 'inet' type cast). The cause is non-duplicated
backslash when specifying pattern.

Fixed by adding duplicated backslash [1].

[1]: http://www.postgresql.org/docs/9.3/static/functions-matching.html

Change-Id: I6923e1d99185e9aca69036edda00293ed1718b92
Bug-Url: https://bugzilla.redhat.com/1164235
Signed-off-by: Frantisek Kobzik <fkob...@redhat.com>
---
M packaging/dbscripts/create_functions.sql
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/36946/1

diff --git a/packaging/dbscripts/create_functions.sql 
b/packaging/dbscripts/create_functions.sql
index c920285..f102974 100644
--- a/packaging/dbscripts/create_functions.sql
+++ b/packaging/dbscripts/create_functions.sql
@@ -894,10 +894,10 @@
 AS $procedure$
 BEGIN
 CASE
-    WHEN ($1 IS NULL) OR ($1 ~ E'^\s*$') THEN
+    WHEN ($1 IS NULL) OR ($1 ~ E'^\\s*$') THEN
         RETURN NULL;
     ELSE
-        RETURN regexp_split_to_array(trim(both from $1), E'\s+')::inet[];
+        RETURN regexp_split_to_array(trim(both from $1), E'\\s+')::inet[];
 END CASE;
 END; $procedure$
 LANGUAGE plpgsql;


-- 
To view, visit http://gerrit.ovirt.org/36946
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6923e1d99185e9aca69036edda00293ed1718b92
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <fkob...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to