How do JSON types relate the PG column types? #4058
Replies: 1 comment 1 reply
-
The parsing of JSON is done by PostgreSQL's
(emphasis mine) The last two explain what you see here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I’ve been reading through the docs, and in particular Tables and Views and Resource Representation and Working with PostgreSQL data types, but I struggle to find an explanation and fix for the following behavior except this hint
at the beginning of a section here.
I’ve got a view on top of the schema-protected user table:
and therefore a
/profile
endpoint. Note that bothfirst_name
andlast_name
are nullabletext
type columns. Surprisingly, though, I am able to insert non-text values which seem to be coaxed to text, e.g.accepts the list of numbers and turns it into text and updates the column:
It works the same with any other non-string JSON value like
true
(boolean) or3.14
(float) and so forth. They all seem to be coaxed to text, although I had expected a 400 response status for any non-string values here?!Could somebody please shed some light on this behavior? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions