You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create table crap (test integer);
CREATE TABLE
insert into crap values (456);
INSERT 0 1
select row_to_json(crap) as j from crap;
j
--------------
{"test":456}
But if instead I use...
create table crap2 (test uint4);
CREATE TABLE
insert into crap2 values (456);
INSERT 0 1
select row_to_json(crap2) as j from crap2;
j
----------------
{"test":"456"}
This is a minor nitpick of course. I was hoping that there's some clever create cast statement that will resolve the issue. Or would a solution need to be more involved than this?
The text was updated successfully, but these errors were encountered:
createfunctionjson(uint4) returns json as'select $1::text::json;' language sql immutable returns nullonnull input;
create cast (uint4 as json) with function json(uint4);
select row_to_json(crap2) as j from crap2;
j
--------------
{"test":456}
Though I don't know if it is optimal, this seems to work.
But if instead I use...
This is a minor nitpick of course. I was hoping that there's some clever
create cast
statement that will resolve the issue. Or would a solution need to be more involved than this?The text was updated successfully, but these errors were encountered: