Re: looping over a small record set over and over in a function
От | John DeSoi |
---|---|
Тема | Re: looping over a small record set over and over in a function |
Дата | |
Msg-id | D02B9D8F-D55D-4C66-BFA3-79C716882790@pgedit.com обсуждение исходный текст |
Ответ на | Re: looping over a small record set over and over in a function (Ivan Sergio Borgonovo <mail@webthatworks.it>) |
Список | 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.
В списке pgsql-general по дате отправления: