From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | karsten <karsten(at)terragis(dot)net> |
Cc: | "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org> |
Subject: | Re: plphyton function - return each list value as a row ? |
Date: | 2020-07-25 21:32:47 |
Message-ID: | CAKFQuwbWaLSuWrCEjYSkBMU8NqtGc82yN3BSEFx===rD7ONDbA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
On Saturday, July 25, 2020, karsten <karsten(at)terragis(dot)net> wrote:
> Hi All,
>
> I am trying to create my first plphyton function ( retrieving earthquake
> data from an API) .
> Overall I was able to get one single row to be returned, but am struggling
> how to return the entire list I have as multiple rows - see below.
> Currently
> I get the following error when running the GetEartquakeAll function:
>
> select GetEartquakeAll('2020-01-01' ,'2020-03-01', -120, 40,200, 1.7)
> gives me
> ERROR: length of returned sequence did not match number of columns in row
>
> How can I 'simply' return each list value as a row ?
> Thanks
> Karsten Vennemann
>
> CREATE OR REPLACE FUNCTION GetEartquakeAll(start date ,stop date, lon
> float,
> lat float,radius int, minmagnitude float) RETURNS equake_values AS $$
>
The choice of mailing list for this is unusual as this seems to have
nothing to do with general SQL.
Anyway, you may find the following documentation section useful.
https://www.postgresql.org/docs/12/plpython-data.html#id-1.8.11.11.7
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | karsten | 2020-07-25 21:41:50 | plphyton function - return each list value as a row ? |
Previous Message | karsten | 2020-07-25 21:26:45 | plphyton function - return each list value as a row ? |
From | Date | Subject | |
---|---|---|---|
Next Message | karsten | 2020-07-25 21:41:50 | plphyton function - return each list value as a row ? |
Previous Message | karsten | 2020-07-25 21:26:45 | plphyton function - return each list value as a row ? |