Updated keywords and functions for PostgreSQL 9.3. Added sub-mode support for JavaScript and Json.
This commit is contained in:
parent
c612dac355
commit
48cd7f55dc
2 changed files with 328 additions and 261 deletions
|
|
@ -41,8 +41,8 @@ SELECT city, temp_lo, temp_hi, prcp, "date", location
|
|||
|
||||
/**
|
||||
* Dollar quotes starting at the end of the line are colored as SQL unless
|
||||
* a special language tag is used. Pearl and Python are currently implemented
|
||||
* but lots of others are possible.
|
||||
* a special language tag is used. Dollar quote syntax coloring is implemented
|
||||
* for Perl, Python, JavaScript, and Json.
|
||||
*/
|
||||
create or replace function blob_content_chunked(
|
||||
in p_data bytea,
|
||||
|
|
@ -82,6 +82,24 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS $python$
|
|||
SD["plan"] = plan
|
||||
$python$ LANGUAGE plpythonu;
|
||||
|
||||
-- pl/v8 (javascript)
|
||||
CREATE FUNCTION plv8_test(keys text[], vals text[]) RETURNS text AS $javascript$
|
||||
var o = {};
|
||||
for(var i=0; i<keys.length; i++){
|
||||
o[keys[i]] = vals[i];
|
||||
}
|
||||
return JSON.stringify(o);
|
||||
$javascript$ LANGUAGE plv8 IMMUTABLE STRICT;
|
||||
|
||||
-- json
|
||||
select * from json_object_keys($json$
|
||||
{
|
||||
"f1": 5,
|
||||
"f2": "test",
|
||||
"f3": {}
|
||||
}
|
||||
$json$);
|
||||
|
||||
|
||||
-- psql commands
|
||||
\df cash*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue