From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Daniele Varrazzo <daniele.varrazzo@gmail.com>
To: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: Fixed PL/Python hint about array of composites
Date: Thu, 22 Jun 2017 14:49:39 +0300
Message-ID: <e433123a-4bfd-1580-527a-b8cad112fce2@iki.fi> (raw)
In-Reply-To: <CA+mi_8YVHy+MgB1w=9GGQ+zTTV35xLuy9BtyW1nX4YcPr9akxw@mail.gmail.com>
References: <CA+mi_8YOnvOG79vm+XzQ+a5v3TmFM7ynaNiKzMoz-DhPkRT23g@mail.gmail.com>
<CA+mi_8YVHy+MgB1w=9GGQ+zTTV35xLuy9BtyW1nX4YcPr9akxw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 05/29/2017 07:43 PM, Daniele Varrazzo wrote:
> On Mon, May 29, 2017 at 5:38 PM, Daniele Varrazzo
> <daniele.varrazzo@gmail.com> wrote:
>> The error message hint suggests [('foo')]. ('foo') is not a valid
>> Python tuple: it's a literal with redundant parentheses. ('foo',) is a
>> valid tuple.
>>
>> Patch to correct the hints and an occurrence in the test suite attached.
> -HINT: To return a composite type in an array, return the composite type as a Python tuple, e.g. "[('foo')]"
> +HINT: To return a composite type in an array, return the composite type as a Python tuple, e.g. "[('foo',)]".
Huh, that looks weird. Perhaps we should use an example with two-element
tuple in the example, to avoid the awkward trailing comma?
Then again, it's a useful to have it in the example, exactly because
it's not obvious what you need to do with a 1-element tuple. Or maybe
use "[('foo', 'bar',)]" in the example?
Maybe this is well known to all Python programmers, and I'm worrying
about nothing.. I'm not too familiar with Python.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: hlinnaka@iki.fi, daniele.varrazzo@gmail.com
Subject: Re: Fixed PL/Python hint about array of composites
In-Reply-To: <e433123a-4bfd-1580-527a-b8cad112fce2@iki.fi>
References: <CA+mi_8YOnvOG79vm+XzQ+a5v3TmFM7ynaNiKzMoz-DhPkRT23g@mail.gmail.com> <CA+mi_8YVHy+MgB1w=9GGQ+zTTV35xLuy9BtyW1nX4YcPr9akxw@mail.gmail.com> <e433123a-4bfd-1580-527a-b8cad112fce2@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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