diff options
author | Andrew Klychkov <aaklychkov@mail.ru> | 2021-02-07 09:09:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-07 00:09:26 -0600 |
commit | 069311bff3c6c9bf4bc0120ec4a493644acdc9b4 (patch) | |
tree | 498e7e8555f783ec407baca311501b7503f51f8e /lib | |
parent | 49ebd509df9de1c1fc1bcee00e79a835dd00662c (diff) | |
download | ansible-069311bff3c6c9bf4bc0120ec4a493644acdc9b4.tar.gz |
postgresql_query: fix datetime.timedelta type handling (#73520)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/modules/database/postgresql/postgresql_query.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/modules/database/postgresql/postgresql_query.py b/lib/ansible/modules/database/postgresql/postgresql_query.py index dc386d6a62..ca056566b0 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_query.py +++ b/lib/ansible/modules/database/postgresql/postgresql_query.py @@ -168,6 +168,7 @@ rowcount: sample: 5 ''' +import datetime import decimal try: @@ -312,6 +313,9 @@ def main(): if isinstance(val, decimal.Decimal): row[key] = float(val) + elif isinstance(val, datetime.timedelta): + row[key] = str(val) + query_result.append(row) except Psycopg2ProgrammingError as e: if to_native(e) == 'no results to fetch': |