Mercurial > lada > lada-server
comparison db_schema/audit.sql @ 1315:84bb7e2aecb1
Do not redefine existing operator.
The removed SQL failed on PostgreSQL 9.5 because the operator is
provided and needed by the system. Further, it does not seem to be
used here.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 17 Mar 2017 13:25:57 +0100 |
parents | 1a3e86f4d768 |
children | d3113d594013 |
comparison
equal
deleted
inserted
replaced
1314:1a3e86f4d768 | 1315:84bb7e2aecb1 |
---|---|
48 DROP OPERATOR IF EXISTS - (jsonb, text[]); | 48 DROP OPERATOR IF EXISTS - (jsonb, text[]); |
49 CREATE OPERATOR - ( PROCEDURE = jsonb_delete_left, LEFTARG = jsonb, RIGHTARG = text[]); | 49 CREATE OPERATOR - ( PROCEDURE = jsonb_delete_left, LEFTARG = jsonb, RIGHTARG = text[]); |
50 COMMENT ON OPERATOR - (jsonb, text[]) IS 'delete keys from left operand'; | 50 COMMENT ON OPERATOR - (jsonb, text[]) IS 'delete keys from left operand'; |
51 | 51 |
52 | 52 |
53 CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b text) | |
54 RETURNS jsonb AS | |
55 $BODY$ | |
56 SELECT COALESCE( | |
57 ( | |
58 SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') | |
59 FROM jsonb_each(a) | |
60 WHERE key <> b | |
61 ) | |
62 , '{}')::jsonb; | |
63 $BODY$ | |
64 LANGUAGE sql IMMUTABLE STRICT; | |
65 COMMENT ON FUNCTION jsonb_delete_left(jsonb, text) IS 'delete key in second argument from first argument'; | |
66 DROP OPERATOR IF EXISTS - (jsonb, text); | |
67 CREATE OPERATOR - ( PROCEDURE = jsonb_delete_left, LEFTARG = jsonb, RIGHTARG = text); | |
68 COMMENT ON OPERATOR - (jsonb, text) IS 'delete key from left operand'; | |
69 | |
70 | |
71 CREATE OR REPLACE FUNCTION if_modified_func() RETURNS TRIGGER AS $body$ | 53 CREATE OR REPLACE FUNCTION if_modified_func() RETURNS TRIGGER AS $body$ |
72 DECLARE | 54 DECLARE |
73 audit_row land.audit_trail; | 55 audit_row land.audit_trail; |
74 include_values boolean; | 56 include_values boolean; |
75 log_diffs boolean; | 57 log_diffs boolean; |