Skip to content

Why PostgREST assume oid types are string? #2278

Answered by steve-chavez
gkobluk asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

postgREST is just using the default PostgreSQL json_agg:

postgres=# select json_agg('{1,2,3,4,5}'::oid[]);
        json_agg
-------------------------
 [["1","2","3","4","5"]]
(1 row)

postgres=# select to_json('{1,2,3,4,5}'::oid[]);
        to_json
-----------------------
 ["1","2","3","4","5"]
(1 row)

postgres=# select to_json(3::oid);
 to_json
---------
 "3"
(1 row)

Which casts oids to strings, as it can be seen above.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@gkobluk
Comment options

@steve-chavez
Comment options

@steve-chavez
Comment options

@gkobluk
Comment options

Answer selected by gkobluk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants