Re: plpython feature idea: an option to return row results as lists

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Derek Arnold <derek(dot)arnold(at)dealerbuilt(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython feature idea: an option to return row results as lists
Date: 2010-07-30 22:21:09
Message-ID: AANLkTimPAkGpqUd7Y9VNLwN8sdZ8KDfCsS8A1ME4nvxn@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 30, 2010 at 15:45, Derek Arnold
<derek(dot)arnold(at)dealerbuilt(dot)com> wrote:
> With result rows in plpython returned as dicts rather than lists, we ran
> into issues with a need to preserve the column order in the resultset.

Interesting, +1 for the idea.

> plpy.execute("""
> SELECT 1 as a, 2 as b, NULL as c, ARRAY[1,2,3] as d;
> """, return_list=True)

Hrm... Maybe a separate function is better. I dont think that will
translate to other languages very well. For instance pl/perl, you
would end up doing something like spi_exec_query("select 1;",
undefined, {return_list=>1}); ick. Yes we could make spi_exec_query()
say oh the 2nd arg is a hash? well then its the options. Seems
fragile, and i dunno about other pls.

FYI, I did look at pl/perl and pl/tcl and they seem to be able to only
return "dictionaries" as well.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2010-07-31 04:23:39 Re: plpython feature idea: an option to return row results as lists
Previous Message Derek Arnold 2010-07-30 21:45:09 plpython feature idea: an option to return row results as lists