Yair Zaslavsky has uploaded a new change for review.

Change subject: engine: Adding a helper function to check if table exists
......................................................................

engine: Adding a helper function to check if table exists

Change-Id: I9421526de442640cf985cb0302f7fa3d6daa909a
Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com>
---
M packaging/dbscripts/create_functions.sql
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/37421/1

diff --git a/packaging/dbscripts/create_functions.sql 
b/packaging/dbscripts/create_functions.sql
index c920285..83f752d 100644
--- a/packaging/dbscripts/create_functions.sql
+++ b/packaging/dbscripts/create_functions.sql
@@ -25,6 +25,18 @@
         authz character varying(255)
 );
 
+CREATE OR REPLACE FUNCTION fn_table_exists (v_table varchar(64)) returns 
boolean STABLE
+   AS $procedure$
+   declare
+   retvalue  boolean;
+BEGIN
+   retvalue := EXISTS (
+               SELECT * FROM information_schema.tables WHERE table_schema = 
'public' AND table_name = v_table
+   );
+   return retvalue;
+END; $procedure$
+LANGUAGE plpgsql; 
+
 
 CREATE OR REPLACE FUNCTION getGlobalIds(v_name VARCHAR(4000))
 RETURNS UUID IMMUTABLE STRICT


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

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

Reply via email to