[Groonga-commit] pgroonga/pgroonga at 3124210 [master] Add upgrade SQL

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Sep 26 20:45:00 JST 2015


Kouhei Sutou	2015-09-26 20:45:00 +0900 (Sat, 26 Sep 2015)

  New Revision: 312421028b621cb0850d87d61e0e482c69c131e8
  https://github.com/pgroonga/pgroonga/commit/312421028b621cb0850d87d61e0e482c69c131e8

  Message:
    Add upgrade SQL
    
    I hope that it works...

  Added files:
    pgroonga--0.8.0--0.9.0.sql
  Modified files:
    .gitignore

  Modified: .gitignore (+2 -1)
===================================================================
--- .gitignore    2015-09-26 20:43:17 +0900 (1e3a71c)
+++ .gitignore    2015-09-26 20:45:00 +0900 (3b6e354)
@@ -2,7 +2,8 @@
 *.so
 *.tar.gz
 *.zip
-*--*.sql
+pgroonga--*.sql
+!pgroonga--*--*.sql
 /regression.*
 /results/
 /packages/source/

  Added: pgroonga--0.8.0--0.9.0.sql (+30 -0) 100644
===================================================================
--- /dev/null
+++ pgroonga--0.8.0--0.9.0.sql    2015-09-26 20:45:00 +0900 (09fdc6e)
@@ -0,0 +1,30 @@
+UPDATE pg_catalog.pg_am SET amstrategies = 9 WHERE amname = 'pgroonga';
+
+DO LANGUAGE plpgsql $$
+BEGIN
+	PERFORM 1
+		FROM pg_type
+		WHERE typname = 'jsonb';
+
+	IF FOUND
+	THEN
+		CREATE FUNCTION pgroonga.match(jsonb, text)
+			RETURNS bool
+			AS 'MODULE_PATHNAME', 'pgroonga_match_jsonb'
+			LANGUAGE C
+			IMMUTABLE
+			STRICT;
+
+		CREATE OPERATOR @@ (
+			PROCEDURE = pgroonga.match,
+			LEFTARG = jsonb,
+			RIGHTARG = text
+		);
+
+		CREATE OPERATOR CLASS pgroonga.jsonb_ops DEFAULT FOR TYPE jsonb
+			USING pgroonga AS
+				OPERATOR 8 @@ (jsonb, text),
+				OPERATOR 9 @>;
+	END IF;
+END;
+$$;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index