Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-23 Thread Merlin Moncure
On Tue, Aug 21, 2012 at 2:56 AM, Craig Ringer wrote: > On 08/21/2012 03:01 PM, Martijn van Oosterhout wrote: >> >> Well, Postgres in principle supports arrays of records, so I've >> wondered if a relationship join could stuff all the objects in a single >> field of the response using an aggregate.

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-22 Thread Chris Travers
Hi all; So I found an interesting and relatively manageable way of doing this. Suppose we have an inventory table: CREATE TABLE inventory_item ( id serial primary key, cogs_account_id int references account(id), inv_account_id int references account(id), income_account_id int ref

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-21 Thread Craig Ringer
On 08/21/2012 03:01 PM, Martijn van Oosterhout wrote: Well, Postgres in principle supports arrays of records, so I've wondered if a relationship join could stuff all the objects in a single field of the response using an aggregate. I think what's always prevented this from working is that client

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-21 Thread Martijn van Oosterhout
On Tue, Aug 21, 2012 at 09:39:20AM +0800, Craig Ringer wrote: > On 08/21/2012 03:06 AM, Martijn van Oosterhout wrote: > >I'm not sure I have an opinion on pushing ORM features to the database > >layer, SQLAlchemy is doing a pretty good job for me already. > > There are some things ORMs could reall

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-20 Thread Craig Ringer
On 08/21/2012 03:06 AM, Martijn van Oosterhout wrote: I'm not sure I have an opinion on pushing ORM features to the database layer, SQLAlchemy is doing a pretty good job for me already. There are some things ORMs could really use help from the database with, though. Particularly when fetching

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-20 Thread Martijn van Oosterhout
On Sun, Aug 19, 2012 at 06:28:57PM -0700, Chris Travers wrote: > In DB2 this might be done like: > > SELECT * FROM address WHERE address->country->short_name = 'US'; > > I like DB2's approach better because there is no ambiguity between > namespace resolution but I don't entirely like the way the

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-19 Thread Chris Travers
Hi David; On Sun, Aug 19, 2012 at 8:13 PM, David Johnston wrote: > On Aug 19, 2012, at 21:28, Chris Travers wrote: > > > Hi; > > > > I have been reading up on object-relational features of Oracle and DB2 > and found that one of the big things they have that we don't is a path > operator. The i

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-19 Thread Craig Ringer
On 08/20/2012 11:13 AM, David Johnston wrote: On Aug 19, 2012, at 21:28, Chris Travers wrote: Hi; I have been reading up on object-relational features of Oracle and DB2 and found that one of the big things they have that we don't is a path operator. The idea is that you can use the path op

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-19 Thread David Johnston
On Aug 19, 2012, at 21:28, Chris Travers wrote: > Hi; > > I have been reading up on object-relational features of Oracle and DB2 and > found that one of the big things they have that we don't is a path operator. > The idea is that you can use the path operator to follow some subset of > fore

Re: [GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-19 Thread Ondrej Ivanič
Hi, On 20 August 2012 11:28, Chris Travers wrote: > I have been reading up on object-relational features of Oracle and DB2 and > found that one of the big things they have that we don't is a path operator. > The idea is that you can use the path operator to follow some subset of > foreign keys ca

[GENERAL] How hard would a "path" operator be to implement in PostgreSQL

2012-08-19 Thread Chris Travers
Hi; I have been reading up on object-relational features of Oracle and DB2 and found that one of the big things they have that we don't is a path operator. The idea is that you can use the path operator to follow some subset of foreign keys called refs. Suppose we have a table (Oracle/DB2 styles