mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
d9134d0a35
The new format accepts exactly the same data as the json type. However, it is stored in a format that does not require reparsing the orgiginal text in order to process it, making it much more suitable for indexing and other operations. Insignificant whitespace is discarded, and the order of object keys is not preserved. Neither are duplicate object keys kept - the later value for a given key is the only one stored. The new type has all the functions and operators that the json type has, with the exception of the json generation functions (to_json, json_agg etc.) and with identical semantics. In addition, there are operator classes for hash and btree indexing, and two classes for GIN indexing, that have no equivalent in the json type. This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which was intended to provide similar facilities to a nested hstore type, but which in the end proved to have some significant compatibility issues. Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan. Review: Andres Freund
18 lines
525 B
SQL
18 lines
525 B
SQL
/* contrib/hstore/hstore--1.2--1.3.sql */
|
|
|
|
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
|
|
\echo Use "ALTER EXTENSION hstore UPDATE TO '1.3'" to load this file. \quit
|
|
|
|
CREATE FUNCTION hstore_to_jsonb(hstore)
|
|
RETURNS jsonb
|
|
AS 'MODULE_PATHNAME', 'hstore_to_jsonb'
|
|
LANGUAGE C IMMUTABLE STRICT;
|
|
|
|
CREATE CAST (hstore AS jsonb)
|
|
WITH FUNCTION hstore_to_jsonb(hstore);
|
|
|
|
CREATE FUNCTION hstore_to_jsonb_loose(hstore)
|
|
RETURNS jsonb
|
|
AS 'MODULE_PATHNAME', 'hstore_to_jsonb_loose'
|
|
LANGUAGE C IMMUTABLE STRICT;
|