Json support for array pseudotypes

Started by Andrew Dunstanover 9 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36093
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 08:09 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t36093_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t36093_1 && git checkout t36093_1

Patchset v1 (message #1) is on t36093_1

Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

The attached tiny patch lets the to_json(b) routines convert objects
with array pseudotypes to json{b}. The main impetus for this came from
my trying to convert the annyarray columns in pg_stats to json and
finding that they ended up as text instead of json arrays. This way
to_json on these columns does what is expected.

cheers

andrew

--

Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

t36093_1
json_psudotypes.patchtext/x-diff; name=json_psudotypes.patchDownload+6-4
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: Json support for array pseudotypes

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

The attached tiny patch lets the to_json(b) routines convert objects
with array pseudotypes to json{b}. The main impetus for this came from
my trying to convert the annyarray columns in pg_stats to json and
finding that they ended up as text instead of json arrays. This way
to_json on these columns does what is expected.

Looks reasonable offhand, but maybe you should add some test cases?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: Json support for array pseudotypes

On 02/21/2017 06:01 PM, Tom Lane wrote:

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

The attached tiny patch lets the to_json(b) routines convert objects
with array pseudotypes to json{b}. The main impetus for this came from
my trying to convert the annyarray columns in pg_stats to json and
finding that they ended up as text instead of json arrays. This way
to_json on these columns does what is expected.

Looks reasonable offhand, but maybe you should add some test cases?

Yeah, I will. Not sure how to add a test for the RECORDARRAYOID case. We
don't seem to have any of those hanging around.

cheers

andrew

--

Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers