Fixed PL/Python hint about array of composites

Started by Daniele Varrazzoover 9 years ago4 messagesbugs
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t67667
psql -h localhost -U postgres

Built from patchset v2 (message #2), July 28, 2026 at 06:28 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t67667_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t67667_2 && git checkout t67667_2

Patchset v2 (message #2) is on t67667_2

Jump to latest
#1Daniele Varrazzo
daniele.varrazzo@gmail.com

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.

-- Daniele

Attachments:

0001-Fixed-hint-about-returning-composite-type-from-Pytho.patchtext/x-patch; charset=US-ASCII; name=0001-Fixed-hint-about-returning-composite-type-from-Pytho.patchDownload+3-4
#2Daniele Varrazzo
daniele.varrazzo@gmail.com
In reply to: Daniele Varrazzo (#1)
Re: Fixed PL/Python hint about array of composites

Just noticed that the sentence is also missing the final full stop.
New patch attached.

On Mon, May 29, 2017 at 5:38 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:

Show quoted text

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.

-- Daniele

Attachments:

t67667_2
0001-Fixed-hint-about-returning-composite-type-from-Pytho.patchtext/x-patch; charset=US-ASCII; name=0001-Fixed-hint-about-returning-composite-type-from-Pytho.patchDownload+3-4
#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Daniele Varrazzo (#2)
Re: Fixed PL/Python hint about array of composites

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

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Daniele Varrazzo (#2)
Re: Fixed PL/Python hint about array of composites

On 5/29/17 12:43, Daniele Varrazzo wrote:

Just noticed that the sentence is also missing the final full stop.
New patch attached.

committed

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.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs