Lior Vernia has uploaded a new change for review.

Change subject: engine: Created DB function comparable_ip_list
......................................................................

engine: Created DB function comparable_ip_list

The function converts a string of IP addresses, as stored in the
database, to an array of numbers, thus enabling sorting IP addresses
numerically rather than lexicographically.

Change-Id: I6d29697e34c94fdc1321db2318d0e12fe27643da
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=895468
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M backend/manager/dbscripts/create_functions.sql
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/11432/1

diff --git a/backend/manager/dbscripts/create_functions.sql 
b/backend/manager/dbscripts/create_functions.sql
index 0def6cb..ba6a0f5 100644
--- a/backend/manager/dbscripts/create_functions.sql
+++ b/backend/manager/dbscripts/create_functions.sql
@@ -669,3 +669,11 @@
     return v_8_part || v_4_part || v_4_part || v_4_part || v_12_part;
 end; $procedure$
 language plpgsql;
+
+-- This function turns a list of IP addresses to an array of numbers, in
+-- order to correct sorting.
+CREATE OR REPLACE FUNCTION comparable_ip_list(text) RETURNS smallint[]
+LANGUAGE SQL
+IMMUTABLE
+STRICT
+AS $$ SELECT regexp_split_to_array($1, '[. ]')::smallint[] $$;


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

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

Reply via email to