Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
hstore--1.1--1.2.sql54 linesDownload Raw Back to extension
1/* contrib/hstore/hstore--1.1--1.2.sql */2 3-- complain if script is sourced in psql, rather than via ALTER EXTENSION4\echo Use "ALTER EXTENSION hstore UPDATE TO '1.2'" to load this file. \quit5 6 7-- A version of 1.1 was shipped with these objects mistakenly in 9.3.0.8-- Therefore we only add them if we detect that they aren't already there and9-- dependent on the extension.10 11DO LANGUAGE plpgsql12$$13DECLARE14  my_schema pg_catalog.text := pg_catalog.quote_ident(pg_catalog.current_schema());15  old_path pg_catalog.text := pg_catalog.current_setting('search_path');16BEGIN17-- for safety, transiently set search_path to just pg_catalog+pg_temp18PERFORM pg_catalog.set_config('search_path', 'pg_catalog, pg_temp', true);19 20   PERFORM 121   FROM pg_proc p22       JOIN  pg_depend d23          ON p.proname = 'hstore_to_json_loose'24            AND d.classid = 'pg_proc'::regclass25            AND d.objid = p.oid26            AND d.refclassid = 'pg_extension'::regclass27       JOIN pg_extension x28          ON d.refobjid = x.oid29            AND  x.extname = 'hstore';30 31   IF NOT FOUND32   THEN33        PERFORM pg_catalog.set_config('search_path', old_path, true);34 35        CREATE FUNCTION hstore_to_json(hstore)36        RETURNS json37        AS 'MODULE_PATHNAME', 'hstore_to_json'38        LANGUAGE C IMMUTABLE STRICT;39 40        CREATE CAST (hstore AS json)41          WITH FUNCTION hstore_to_json(hstore);42 43        CREATE FUNCTION hstore_to_json_loose(hstore)44        RETURNS json45        AS 'MODULE_PATHNAME', 'hstore_to_json_loose'46        LANGUAGE C IMMUTABLE STRICT;47 48   END IF;49 50PERFORM pg_catalog.set_config('search_path', old_path, true);51END;52 53$$;54 
codekingpro/portable-devtools · Team Ai