|
|
|
|
|
by megous
1859 days ago
|
|
Thanks for the idea. This is a bit shorter: SELECT '"foo"'::jsonb #>>'{}';
But yeah: SELECT jsonb_col['prop1']#>>'{}' FROM ...;
looks a bit meh. And custom right unary operators are on the way out, so one can't even create one for this use case.Anyway, for fun: create function deref_jsonb(jsonb) returns text as $$ begin return $1#>>'{}'; end $$ language plpgsql;
CREATE OPERATOR # ( leftarg = jsonb, function = deref_jsonb );
select '"sdfasdf"'::jsonb #;
select jsonb_col['a']# FROM somewhere;
:) |
|