Skip to content

Info, user, ... modules fail when datestyle = 'redwood,show_time' is set in postgresql.conf #711

@jbisabel

Description

@jbisabel
SUMMARY

When trying to fetch roles info, create users,... the module chokes on timestamps when datestyle = 'redwood,show_time' in the postgresql.conf of the database

ISSUE TYPE
  • Bug Report
COMPONENT NAME

postgresql_info

ANSIBLE VERSION
ansible [core 2.17.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/***/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/***/.venv/lib64/python3.11/site-packages/ansible
  ansible collection location = /home/***/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/***/.venv/bin/ansible
  python version = 3.11.7 (main, Jan 26 2024, 15:26:41) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)] (/home/***/.venv/bin/python3.11)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection        Version
----------------- -------
community.general 9.0.1

CONFIGURATION
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_HASH_BEHAVIOUR(/etc/ansible/ansible.cfg) = merge
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/dynamic_inventory']
DEFAULT_LOAD_CALLBACK_PLUGINS(/etc/ansible/ansible.cfg) = True
DEFAULT_MANAGED_STR(/etc/ansible/ansible.cfg) = This file managed by Ansible. Manual changes will be overwritten on future deployments.
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = default
DEPRECATION_WARNINGS(/etc/ansible/ansible.cfg) = False
DISPLAY_SKIPPED_HOSTS(/etc/ansible/ansible.cfg) = True
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = True
OS / ENVIRONMENT
  • RHEL8
  • psycopg-3.1.19
STEPS TO REPRODUCE
    - name: Gather info
      community.postgresql.postgresql_info:
        port: 5001
        filter:
          - roles
      register: info
EXPECTED RESULTS
ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_community.postgresql.postgresql_info_payload_tkwdwg8r/ansible_community.postgresql.postgresql_info_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_info.py", line 1077, in __exec_sql
  File "/tmp/.venv/lib64/python3.11/site-packages/psycopg/cursor.py", line 859, in fetchall
    records = self._tx.load_rows(self._pos, self.pgresult.ntuples, self._make_row)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.venv/lib64/python3.11/site-packages/psycopg/_transform.py", line 309, in load_rows
    record[col] = self._row_loaders[col](val)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.venv/lib64/python3.11/site-packages/psycopg/types/datetime.py", line 507, in load
    return self._load_method(self, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.venv/lib64/python3.11/site-packages/psycopg/types/datetime.py", line 560, in _load_notimpl
    raise NotImplementedError(
fatal: [**********************]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ca_cert": null,
            "connect_params": {},
            "db": null,
            "filter": [
                "roles"
            ],
            "login_host": "",
            "login_password": "",
            "login_unix_socket": "",
            "login_user": "postgres",
            "port": 5001,
            "session_role": null,
            "ssl_cert": null,
            "ssl_key": null,
            "ssl_mode": "prefer",
            "trust_input": true
        }
    },
    "msg": "Cannot execute SQL 'SELECT r.rolname, r.rolsuper, r.rolcanlogin, r.rolvaliduntil, ARRAY(SELECT b.rolname FROM pg_catalog.pg_auth_members AS m JOIN pg_catalog.pg_roles AS b ON (m.roleid = b.oid) WHERE m.member = r.oid) AS memberof FROM pg_catalog.pg_roles AS r WHERE r.rolname !~ '^pg_'': can't parse timestamptz with DateStyle 'Redwood, SHOW_TIME': 'infinity'"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions