PostgreSQL 9.2 has native JSON support. I'd like to store human readable config files, however, in YAML. And I think I'd like to index a few (but not all) of the config file values. Therefore I'm wondering:
- Is it's somehow possible to include [a third party Javascript library that parses Yaml] in Postgres, for example js-yaml. Then I could have my own YAML Javascript helper, in the same way as there's the built-in JSON helper in PostgreSQL 9.2.
Alternatively:
is it possible to declare individual reusable Javascript functions? If so, then I could add my own YAML parsing functions (based on simple regexps), that are able to parse a subset of YAML, for example the top level key-value pairs here:
# some "top level key-value paris": the_key: 'the value' another_key: 'another value' # But this however: would_be_too_complicated_to_parse_manually_with_regexps: | block string with newlines
Worst case scenario would be that I'd need to duplicate YAML parsing code in each PostgreSQL stored procedure (if I cannot add 3rd party libraries or declare reusable functions).
(Performance wouldn't be terribly important in my case.)
(I've googled a while for "postgresql plv8 reusable function" and "postgresql plv8 library" but found nothing of relevance)