Re: looping over a small record set over and over in a function

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: looping over a small record set over and over in a function
Date: 2009-06-20 13:54:31
Message-ID: D02B9D8F-D55D-4C66-BFA3-79C716882790@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jun 20, 2009, at 8:35 AM, Ivan Sergio Borgonovo wrote:

>> And lastly, if your current approach really is the only way to
>> compute what you're after, then maybe PL/pgSQL isn't the right
>> match for the problem; it looks like you'd be better served by a
>
> Yeah. I gave a look to python but I don't want to add one more
> language to the mix.
> I enjoy strict type checking of plpgsql even if some bit of
> syntactic sugar would help to make it more pleasing and I think it
> is the most lightweight among the offer.
> Still I don't know how easy it is with eg. python to load an array
> with a result set, change it and place it back into the table where
> it was coming from.
>
>> language that can work with arrays of typed structures. As I'm not
>> familiar with the other PL languages I can't tell whether they
>> would be suitable in that respect, but I suspect Python or Java
>> would be able to handle this better.
>
>
> Your suggestion about cursor could be the way... but I don't know
> enough about cursors internals to understand if updating a field of
> a cursor will cause disk writes.

I have not tried this, but the documentation says arrays can be
created for "any built-in or user-defined base type, enum type, or
composite type." So maybe you could define a composite type and stuff
those into a single array?

John DeSoi, Ph.D.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message benoît carpentier 2009-06-20 14:09:17 Benetl, a free ETL tool for files using postgreSQL, is out in version 2.8
Previous Message Hartman, Matthew 2009-06-20 13:19:59 Re: Dynamic table