Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit898d24a

Browse files
committed
PL/Python: Fix hint about returning composite type from Python
('foo') is not a Python tuple: it is a string wrapped in parentheses. Avalid 1-element Python tuple is ('foo',).Author: Daniele Varrazzo <daniele.varrazzo@gmail.com>
1 parentb295cc3 commit898d24a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/pl/plpython/expected/plpython_composite.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,6 @@ $$ LANGUAGE plpythonu;
589589
SELECT * FROM composite_type_as_list_broken();
590590
ERROR: malformed record literal: "first"
591591
DETAIL: Missing left parenthesis.
592-
HINT: To return a composite type in an array, return the composite type as a Python tuple, e.g. "[('foo')]"
592+
HINT: To return a composite type in an array, return the composite type as a Python tuple, e.g., "[('foo',)]".
593593
CONTEXT: while creating return value
594594
PL/Python function "composite_type_as_list_broken"

‎src/pl/plpython/plpy_typeio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ PLyObject_ToDatum(PLyObToDatum *arg, int32 typmod, PyObject *plrv, bool inarray)
949949
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
950950
errmsg("malformed record literal: \"%s\"",str),
951951
errdetail("Missing left parenthesis."),
952-
errhint("To return a composite type in an array, return the composite type as a Python tuple, e.g. \"[('foo')]\"")));
952+
errhint("To return a composite type in an array, return the composite type as a Python tuple, e.g., \"[('foo',)]\".")));
953953
}
954954

955955
returnInputFunctionCall(&arg->typfunc,
@@ -1387,7 +1387,7 @@ PLyGenericObject_ToComposite(PLyTypeInfo *info, TupleDesc desc, PyObject *object
13871387
(errcode(ERRCODE_UNDEFINED_COLUMN),
13881388
errmsg("attribute \"%s\" does not exist in Python object",key),
13891389
inarray ?
1390-
errhint("To return a composite type in an array, return the composite type as a Python tuple, e.g. \"[('foo')]\"") :
1390+
errhint("To return a composite type in an array, return the composite type as a Python tuple, e.g., \"[('foo',)]\".") :
13911391
errhint("To return null in a column, let the returned object have an attribute named after column with value None.")));
13921392
}
13931393

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp