This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
-- plv8: http://code.google.com/p/plv8js/ | |
CREATE OR REPLACE LANGUAGE plv8; | |
-- Create a function that grabs a passed key and coerces to bigint. | |
CREATE OR REPLACE FUNCTION plv8_project_key(key text, json_raw text) | |
RETURNS bigint AS $$ | |
// This is javascript! | |
var o = JSON.parse(json_raw); | |
return o[key]; |