pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5982: recursive type crashes postgres
12+ messages / 6 participants
[nested] [flat]

* BUG #5982: recursive type crashes postgres
@ 2011-04-15 18:34 Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Rikard Pavelic @ 2011-04-15 18:34 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5982
Logged by:          Rikard Pavelic
Email address:      rikard.pavelic@zg.htnet.hr
PostgreSQL version: 9.1.alpha5
Operating system:   Windows XP SP3
Description:        recursive type crashes postgres
Details: 

CREATE TYPE turtle AS 
(
	name varchar	
);
ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;

CREATE TABLE turtles
(
	id int,
	tortoise turtle
);



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
@ 2011-04-15 18:39 ` Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 12+ messages in thread

From: Merlin Moncure @ 2011-04-15 18:39 UTC (permalink / raw)
  To: Rikard Pavelic <rikard.pavelic@zg.htnet.hr>; +Cc: pgsql-bugs

On Fri, Apr 15, 2011 at 1:34 PM, Rikard Pavelic
<rikard.pavelic@zg.htnet.hr> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5982
> Logged by:          Rikard Pavelic
> Email address:      rikard.pavelic@zg.htnet.hr
> PostgreSQL version: 9.1.alpha5
> Operating system:   Windows XP SP3
> Description:        recursive type crashes postgres
> Details:
>
> CREATE TYPE turtle AS
> (
>        name varchar
> );
> ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;
>
> CREATE TABLE turtles
> (
>        id int,
>        tortoise turtle
> );

This is a duplicate: see Mar 28 thread 'Recursive containment of
composite types'.  Was it decided whether to lock the functionality
down or fix it?

merlin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
@ 2011-04-15 19:06   ` Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  0 siblings, 1 reply; 12+ messages in thread

From: Tom Lane @ 2011-04-15 19:06 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: Rikard Pavelic <rikard.pavelic@zg.htnet.hr>; pgsql-bugs

Merlin Moncure <mmoncure@gmail.com> writes:
> On Fri, Apr 15, 2011 at 1:34 PM, Rikard Pavelic
> <rikard.pavelic@zg.htnet.hr> wrote:
>> CREATE TYPE turtle AS
>> (
>>        name varchar
>> );
>> ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;

> This is a duplicate: see Mar 28 thread 'Recursive containment of
> composite types'.  Was it decided whether to lock the functionality
> down or fix it?

The former.

regression=# CREATE TYPE turtle AS 
(
name varchar
);
CREATE TYPE
regression=# ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;
ERROR:  composite type turtle cannot be made a member of itself
regression=# 

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-04-15 20:30     ` Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 12+ messages in thread

From: Rikard Pavelic @ 2011-04-15 20:30 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Merlin Moncure <mmoncure@gmail.com>; pgsql-bugs

On 15.4.2011 21:06, Tom Lane wrote:
> The former.
>
> regression=# CREATE TYPE turtle AS 
> (
> name varchar
> );
> CREATE TYPE
> regression=# ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;
> ERROR:  composite type turtle cannot be made a member of itself
> regression=# 
>
> 			regards, tom lane
>
Todo item?



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
@ 2011-04-15 20:49       ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:04         ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 21:06         ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 2 replies; 12+ messages in thread

From: Kevin Grittner @ 2011-04-15 20:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>; +Cc: Merlin Moncure <mmoncure@gmail.com>; pgsql-bugs

Rikard Pavelic <rikard.pavelic@zg.htnet.hr> wrote:
> On 15.4.2011 21:06, Tom Lane wrote:
>> The former.
>>
>> regression=# CREATE TYPE turtle AS 
>> (
>> name varchar
>> );
>> CREATE TYPE
>> regression=# ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;
>> ERROR:  composite type turtle cannot be made a member of itself
>> regression=# 
 
> Todo item?
 
I haven't seen anything which seems like a reasonable use case yet,
myself.  If you were *actually* tracking turtles and their
offspring, that would be a completely worthless data structure.  Is
there really a case where a reference to the ID of an object of like
type isn't a better solution? 
 
-Kevin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2011-04-15 21:04         ` Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 21:19           ` Re: BUG #5982: recursive type crashes postgres John R Pierce <pierce@hogranch.com>
  1 sibling, 1 reply; 12+ messages in thread

From: Rikard Pavelic @ 2011-04-15 21:04 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Merlin Moncure <mmoncure@gmail.com>; pgsql-bugs

On 15.4.2011 22:49, Kevin Grittner wrote:
> Rikard Pavelic <rikard.pavelic@zg.htnet.hr> wrote:
>> On 15.4.2011 21:06, Tom Lane wrote:
>>> The former.
>>>
>>> regression=# CREATE TYPE turtle AS 
>>> (
>>> name varchar
>>> );
>>> CREATE TYPE
>>> regression=# ALTER TYPE turtle ADD ATTRIBUTE offspring turtle;
>>> ERROR:  composite type turtle cannot be made a member of itself
>>> regression=# 
>  
>> Todo item?
>  
> I haven't seen anything which seems like a reasonable use case yet,
> myself.  If you were *actually* tracking turtles and their
> offspring, that would be a completely worthless data structure.  Is
> there really a case where a reference to the ID of an object of like
> type isn't a better solution? 
>  
> -Kevin
>

I'm trying to map application and database domain as close as possible.
So it's not that I have an use case, but have a mismatch which cannot be mapped.
This feature would reduce object-relational impedance mismatch in DDD,
so I think it is worth an Todo item.
Is this design strange/stupid? Probably.
But, currently it behaves as struct. It would be nice if it behaved as class
(when attribute is nullable).

Regards,
Rikard



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:04         ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
@ 2011-04-15 21:19           ` John R Pierce <pierce@hogranch.com>
  0 siblings, 0 replies; 12+ messages in thread

From: John R Pierce @ 2011-04-15 21:19 UTC (permalink / raw)
  To: pgsql-bugs

On 04/15/11 2:04 PM, Rikard Pavelic wrote:
> This feature would reduce object-relational impedance mismatch in DDD,

objects aren't relational.    deal with it.  OOPS may be a reasonable 
methodology for coding, however its purely hierarchical, and doesn't map 
at all well to relational calculus.    round peg, square hole.   There 
are tools in the toolbox other than hammers, you know.









^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2011-04-15 21:06         ` Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 21:27           ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  1 sibling, 1 reply; 12+ messages in thread

From: Merlin Moncure @ 2011-04-15 21:06 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>; pgsql-bugs

On Fri, Apr 15, 2011 at 3:49 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> I haven't seen anything which seems like a reasonable use case yet,
> myself.  If you were *actually* tracking turtles and their
> offspring, that would be a completely worthless data structure.  Is
> there really a case where a reference to the ID of an object of like
> type isn't a better solution?

There are lots of use cases for this.  I use composite types to
marshal data to the client all the time, and recursive structures are
fairly common in many classic problems.  Recursive composites fit the
bill perfectly.

merlin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:06         ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
@ 2011-04-15 21:27           ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:56             ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Kevin Grittner @ 2011-04-15 21:27 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: pgsql-bugs; Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>

Merlin Moncure <mmoncure@gmail.com> wrote:
 
> There are lots of use cases for this.  I use composite types to
> marshal data to the client all the time, and recursive structures
> are fairly common in many classic problems.  Recursive composites
> fit the bill perfectly.
 
I'm trying to get my head around why SQL composite types are a good
way to marshal complex object graphs with recursion.  I can see
where it could be done, I'm still not convinced that it's better
than SQL passing out data in tabular form with relationship
established by matching values.  In other words, when is it a good
idea to do the relation to object mapping in the database engine?
 
-Kevin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:06         ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 21:27           ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2011-04-15 21:56             ` Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 22:14               ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 12+ messages in thread

From: Merlin Moncure @ 2011-04-15 21:56 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: pgsql-bugs; Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>

On Fri, Apr 15, 2011 at 4:27 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> Merlin Moncure <mmoncure@gmail.com> wrote:
>
>> There are lots of use cases for this.  I use composite types to
>> marshal data to the client all the time, and recursive structures
>> are fairly common in many classic problems.  Recursive composites
>> fit the bill perfectly.
>
> I'm trying to get my head around why SQL composite types are a good
> way to marshal complex object graphs with recursion.  I can see
> where it could be done, I'm still not convinced that it's better
> than SQL passing out data in tabular form with relationship
> established by matching values.  In other words, when is it a good
> idea to do the relation to object mapping in the database engine?

You can certainly do that.  however that requires the client to put
take the data and immediately put it in relational-ish data structures
so you can browse the data properly.  That's a popular approach,
albeit expensive and error prone.  If the database sends it back to
you constructed, you can just stupldly iterate over the returned set
and process it as you go (you could in fact stream the data directly
off the protocol of the client library supports it).

arrays, composites, etc. are just ways of setting up ad hoc structures
for passing.  they serve the same purpose (at least, they way I use
them) as xml or json documents getting ripped directly in and out of
the database.  maybe it's a good idea to nest data that way going and
out, and maybe it isn't, but it's fast and effective.  xml and json
solve the problem but introduce a completely difference set of
headaches because they are not tightly coupled to the database...and
slow.

Consider we also have to send data to the database.  I can recursively
wrap up data in the client using libpqtypes, fire it to a receiving
function which unnests it and processes it.  This is a couple of
orders of magnitude faster than streaming it in over multiple queries.
 I could for example, send in a entire bill of materials assembly in a
single query.   I don't consider that hacky, in fact I think a lot of
classic SQL approaches are in fact hacks around not being able to do
things that way.

merlin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:06         ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 21:27           ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:56             ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
@ 2011-04-15 22:14               ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 23:28                 ` Re: BUG #5982: recursive type crashes postgres Andrew Chernow <ac@esilo.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Kevin Grittner @ 2011-04-15 22:14 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: pgsql-bugs; Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>

Merlin Moncure <mmoncure@gmail.com> wrote:
 
> Consider we also have to send data to the database.  I can
> recursively wrap up data in the client using libpqtypes, fire it
> to a receiving function which unnests it and processes it.  This
> is a couple of orders of magnitude faster than streaming it in
> over multiple queries.
 
I'll think on that.  I hadn't really considered creating an ORM in
the database engine itself, which seems to me to be what you're
describing, but I guess it couldn't be worse than having an ORM on
the other end of the wire.
 
Is that a hard sell to your application programmers, or do you wear
both hats?
 
-Kevin



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: BUG #5982: recursive type crashes postgres
  2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 18:39 ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 19:06   ` Re: BUG #5982: recursive type crashes postgres Tom Lane <tgl@sss.pgh.pa.us>
  2011-04-15 20:30     ` Re: BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
  2011-04-15 20:49       ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:06         ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 21:27           ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2011-04-15 21:56             ` Re: BUG #5982: recursive type crashes postgres Merlin Moncure <mmoncure@gmail.com>
  2011-04-15 22:14               ` Re: BUG #5982: recursive type crashes postgres Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2011-04-15 23:28                 ` Andrew Chernow <ac@esilo.com>
  0 siblings, 0 replies; 12+ messages in thread

From: Andrew Chernow @ 2011-04-15 23:28 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: Merlin Moncure <mmoncure@gmail.com>; pgsql-bugs; Tom Lane <tgl@sss.pgh.pa.us>; Rikard Pavelic <rikard.pavelic@zg.htnet.hr>

On 4/15/2011 6:14 PM, Kevin Grittner wrote:
> Merlin Moncure<mmoncure@gmail.com>  wrote:
>
>> Consider we also have to send data to the database.  I can
>> recursively wrap up data in the client using libpqtypes, fire it
>> to a receiving function which unnests it and processes it.  This
>> is a couple of orders of magnitude faster than streaming it in
>> over multiple queries.
>
> I'll think on that.  I hadn't really considered creating an ORM in
> the database engine itself, which seems to me to be what you're
> describing, but I guess it couldn't be worse than having an ORM on
> the other end of the wire.
>
> Is that a hard sell to your application programmers, or do you wear
> both hats?
>

libpqtypes is very easy to use, small learning curve.  Should be easy for 
someone with libpq experience.

Merlin is describing loop,pack,exec vs. loop,exec where the former packs an 
array of parameters and performs one transaction, and the latter must execute 
multiple transactions one at a time.  If you take the params of an insert and 
create a composite out of it, you can wrap the insert into a function that takes 
an array of that composite.  You are not creating any new bindings, translations 
or encodings, just leveraging existing functionality a little differently.

-- 
Andrew Chernow
eSilo, LLC
global backup
http://www.esilo.com/



^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2011-04-15 23:28 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15 18:34 BUG #5982: recursive type crashes postgres Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
2011-04-15 18:39 ` Merlin Moncure <mmoncure@gmail.com>
2011-04-15 19:06   ` Tom Lane <tgl@sss.pgh.pa.us>
2011-04-15 20:30     ` Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
2011-04-15 20:49       ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-15 21:04         ` Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
2011-04-15 21:19           ` John R Pierce <pierce@hogranch.com>
2011-04-15 21:06         ` Merlin Moncure <mmoncure@gmail.com>
2011-04-15 21:27           ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-15 21:56             ` Merlin Moncure <mmoncure@gmail.com>
2011-04-15 22:14               ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-15 23:28                 ` Andrew Chernow <ac@esilo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox