Open bjne opened 8 years ago
There is a small example with hstore in pgfunctest.sql
do $$
local hstore = {
fromstring = function(text)
return fromstring('hstore',text)
end,
akeys = pgfunc('akeys(hstore)',{only_internal = false}),
each = pgfunc('each(hstore)',{only_internal = false}) --orig:each(IN hs hstore, OUT key text, OUT value text)
}
local v = hstore.fromstring[[
"paperback" => "542",
"publisher" => "postgresql.org",
"language" => "English",
"ISBN-13" => "978-0000000000",
"weight" => "24.1 ounces"
]]
print(v)
for _,v in ipairs(hstore.akeys(v)) do
print (v)
end
for hv in hstore.each(v) do
print ("key = " .. hv.key .. " value = "..hv.value)
end
$$ language pllua;
You can try using jsonb in the same way
Would you consider adding json/jsonb transform support? At the momement, I accomplish this with cjson, but would be nice if this dependency could disappear.