From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Fixed PL/Python hint about array of composites |
Date: | 2017-06-22 11:49:39 |
Message-ID: | e433123a-4bfd-1580-527a-b8cad112fce2@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 05/29/2017 07:43 PM, Daniele Varrazzo wrote:
> On Mon, May 29, 2017 at 5:38 PM, Daniele Varrazzo
> <daniele(dot)varrazzo(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Turelinckx | 2017-06-22 13:49:27 | Re: Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc) |
Previous Message | Ben Cook | 2017-06-21 19:02:34 | Password Error |