I hereby claim:
- I am rafaelveloso on github.
- I am rafaelveloso (https://keybase.io/rafaelveloso) on keybase.
- I have a public key whose fingerprint is C2DC 4D2E 8940 9AA3 E2B3 E598 F336 4816 A3AC 8AC1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
CREATE OR REPLACE FUNCTION jsonb_equality(left_arg jsonb, right_arg jsonb) | |
RETURNS bool AS | |
$BODY$ | |
SELECT left_arg @> right_arg AND left_arg <@ right_arg; | |
$BODY$ | |
LANGUAGE SQL IMMUTABLE STRICT; | |
CREATE OPERATOR = ( | |
LEFTARG = jsonb, | |
RIGHTARG = jsonb, |
CREATE OR REPLACE FUNCTION json_access(obj json, path text) RETURNS json AS $$ | |
var obj = JSON.parse(obj); | |
var paths = path.split("."); | |
var p; | |
var ret; | |
while (p = paths.shift()) { | |
if (typeof obj[p] == 'undefined'){ | |
obj = null; | |
break | |
} |
CREATE OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$ | |
SELECT replace($1, '''', '\'''); $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$ | |
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$ | |
SELECT '''' || to_json($1) || ''': ''' || to_json($2) || ''''; $$ LANGUAGE SQL IMMUTABLE; |
/****************************************************************************** | |
How to load Javascript modules into postgres | |
******************************************************************************/ | |
CREATE EXTENSION IF NOT EXISTS plv8 | |
/****************************************************************************** | |
First step is download the Javascript module file | |
Example with undescore-min and node-jpath | |
******************************************************************************/ |