From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Jakub Palenik <jakub(dot)palenik(at)biosort(dot)no> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Jsonb gets extra quotes when returned from a function that break json format |
Date: | 2021-05-19 18:06:57 |
Message-ID: | CAFj8pRC3Xz1WWXdMV-d1=hxi0_c4==M0=udpymbgZhgZPiZ28g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
st 19. 5. 2021 v 17:04 odesílatel Jakub Palenik <jakub(dot)palenik(at)biosort(dot)no>
napsal:
> Greetings,
> I am using postgres database running within docker v13.3 (latest). I have
> found an issue where jsonb and timestamp type returned from function saved
> in the db assumes extra quotes and thus break json format.
>
> I have a table that has a column of jsonb type.
>
>
> when I query this table json be is returned correctly (as stored).
>
>
> When I use this querry within a function, the jsonb column is modified
> such that every value in the json tree assumes extra quotes:
>
> For information completness sake, this only happens if there is other than
> jsonb type in thre returns table statement:
>
> Timestamp also gets extra quotes when included in the return table
> statement (I have demostrated the case above with minimal example.
> Following snippet is result of actual function that I use):
>
>
This is expected behave. When the function returns composite value, then
you get composite value when you call function in scalar context. If you
call this function in table context (clause from), then you get the
relation. When the function returns one column, then returns scalar or
scalar set. When returns two or more columns, then returns composite or
table.
just you should to call your function like
select * from get_streams_params(array[1]);
> Best regards,
> Jakub
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Vitaly Ustinov | 2021-05-19 19:18:03 | Generated column is not updated (Postgres 13) |
Previous Message | David G. Johnston | 2021-05-19 16:31:07 | Re: Jsonb gets extra quotes when returned from a function that break json format |