Re: proposal: row_to_array function

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: row_to_array function
Date: 2015-01-16 17:03:00
Message-ID: 54B94444.2080504@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/16/15 3:45 AM, Pavel Stehule wrote:
> I am returning back to processing records in plpgsql.
>
> I am thinking so it can be simply processed with transformations to array.
>
> Now we have similar functions - hstore(row), row_to_json, ... but using of these functions can be a useless step. Any row variable can be transformed to 2D text array.

How is it useless? Why wouldn't you just use JSON and be done with it?

Do you have some use cases you can share?

> There two possible transformations:
>
> row_to_array --> [[key1, value1],[key2, value2], ...]
> row_to_row_array --> [(key1, value1), (key2, value2), ... ]

If we're going to go that route, I think it makes more sense to create an actual key/value type (ie: http://pgxn.org/dist/pair/doc/pair.html) and return an array of that.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-01-16 17:05:02 Re: pgsql: Another attempt at fixing Windows Norwegian locale.
Previous Message Andres Freund 2015-01-16 17:01:24 Re: [PATCH] HINT: pg_hba.conf changed since last config reload