Re: proposal: row_to_array function

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: row_to_array function
Date: 2015-06-23 20:45:41
Message-ID: 5589C575.6080702@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/23/15 3:22 PM, Merlin Moncure wrote:
> I would rephrase that to: "do X to all fields of an object".
> Array handling is pretty good now (minus arrays of arrays, but arrays

Except that still won't make it easy to do something to each element of
an array in SQL, which I think would be nice to have.

> of objects containing arrays is 'good enough' for most real world
> cases). We've suffered for a while now with hstore/json as a
> temporary container to handle operations that are not well supported
> by postgres's particularly strongly typed flavor SQL. The "OO" of
> postgres has been gradually diluting away; it's not a 'object
> relational' database anymore and the OO features, very much a product
> of the silly 90's OO hysteria, have been recast into more useful
> features like inheritance and/or pruned back.

Admittedly I've never played with an OO database, but I think our data
features are pretty good [1]. Where I do think we can improve though is
developing/coding things in the database. For example, I'd love to have
the equivalent to a class. Perhaps that could be accomplished by
allowing multiple instances of an extension. I'd also like stronger
support for private objects (permissions don't really fit that bill).

> I don't mind having to push everything to jsonb and back for tuple
> manipulation and I expect that's how these types of things are going
> to be done moving forwards. jsonb has clearly caught a bid judging by
> what I'm reading in the blogosphere and will continue to accrete
> features things like this.

I think it's unfortunate to lose the strong typing that we have. That
can be especially important for something like numbers (was it
originally a float or a numeric?). But maybe JSON is good enough.

[1] The one OO-ish data feature I'd like is the ability to de-reference
a foreign key "pointer". So if

CREATE TABLE b( a_id int REFERENCES a);

then have

SELECT a_id.some_field FROM b;

transform to

SELECT a.some_field FROM b JOIN a ...;
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-06-23 20:55:08 Re: proposal: row_to_array function
Previous Message Pavel Stehule 2015-06-23 20:40:35 Re: proposal: row_to_array function