Skip to content

Commit

Permalink
Add note about conversion of arrays to lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Sep 23, 2016
1 parent f6e365e commit 67d51fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 10 additions & 1 deletion docs/contents/pg/adaptation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interval datetime.timedelta
hstore dict
json, jsonb list or dict
uuid uuid.UUID
array list
array list [#array]_
record tuple
================================== ==================

Expand All @@ -47,6 +47,15 @@ record tuple

.. [#int8] int8 is converted to long in Python 2
.. [#array] The first element of the array will always be the first element
of the Python list, no matter what the lower bound of the PostgreSQL
array is. The information about the start index of the array (which is
usually 1 in PostgreSQL, but can also be different from 1) is ignored
and gets lost in the conversion to the Python list. If you need that
information, you can request it separately with the `array_lower()`
function provided by PostgreSQL.
Adaptation of parameters
------------------------
When you use the higher level methods of the classic :mod:`pg` module like
Expand Down
2 changes: 1 addition & 1 deletion docs/contents/pg/db_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ in order to allow the caller to work with multiple tables, it is
munged as ``oid(table)`` using the actual name of the table.

Note that since PyGreSQL 5.0 this will return the value of an array
type column as a Python list.
type column as a Python list by default.

insert -- insert a row into a database table
--------------------------------------------
Expand Down
10 changes: 9 additions & 1 deletion docs/contents/pgdb/adaptation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interval datetime.timedelta
hstore dict
json, jsonb list or dict
uuid uuid.UUID
array list
array list [#array]_
record tuple
================================== ==================

Expand All @@ -47,6 +47,14 @@ record tuple

.. [#int8] int8 is converted to long in Python 2
.. [#array] The first element of the array will always be the first element
of the Python list, no matter what the lower bound of the PostgreSQL
array is. The information about the start index of the array (which is
usually 1 in PostgreSQL, but can also be different from 1) is ignored
and gets lost in the conversion to the Python list. If you need that
information, you can request it separately with the `array_lower()`
function provided by PostgreSQL.
Adaptation of parameters
------------------------

Expand Down

0 comments on commit 67d51fd

Please sign in to comment.