Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita181675

Browse files
committed
Use a new hstore extension version for added json functions.
This should have been done when the json functionality was added tohstore in 9.3.0. To handle this correctly, the upgrade script thereforeuses conditional logic by using plpgsql in a DO statement to add the twonew functions and the new cast. If hstore_to_json_loose is detected asalready present and dependent on the hstore extension nothing is done.This will require that the database be loaded with plpgsql.People who have installed the earlier and spurious 1.1 version of hstorewill need to do:ALTER EXTENSION hstore UPDATE;to pick up the new functions properly.
1 parentd942f9d commita181675

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

‎contrib/hstore/hstore--1.1--1.2.sql

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* contrib/hstore/hstore--1.1--1.2.sql*/
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use"ALTER EXTENSION hstore UPDATE TO '1.2'" to load this file. \quit
5+
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 and
9+
-- dependent on the extension.
10+
11+
DO LANGUAGE plpgsql
12+
13+
$$
14+
15+
BEGIN
16+
17+
PERFORM1
18+
FROM pg_proc p
19+
JOIN pg_depend d
20+
ONp.proname='hstore_to_json_loose'
21+
ANDd.objid=p.oid
22+
ANDd.refclassid='pg_extension'::regclass
23+
JOIN pg_extension x
24+
ONd.refobjid=x.oid
25+
ANDx.extname='hstore';
26+
27+
IF NOT FOUND
28+
THEN
29+
30+
CREATEFUNCTIONhstore_to_json(hstore)
31+
RETURNS json
32+
AS'MODULE_PATHNAME','hstore_to_json'
33+
LANGUAGE C IMMUTABLE STRICT;
34+
35+
CREATE CAST (hstoreAS json)
36+
WITH FUNCTION hstore_to_json(hstore);
37+
38+
CREATEFUNCTIONhstore_to_json_loose(hstore)
39+
RETURNS json
40+
AS'MODULE_PATHNAME','hstore_to_json_loose'
41+
LANGUAGE C IMMUTABLE STRICT;
42+
43+
END IF;
44+
45+
END;
46+
47+
$$;
File renamed without changes.

‎contrib/hstore/hstore.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# hstore extension
22
comment = 'data type for storing sets of (key, value) pairs'
3-
default_version = '1.1'
3+
default_version = '1.2'
44
module_pathname = '$libdir/hstore'
55
relocatable = true

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp