Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PDB 6.19.1, PDB 7.7.1
-
None
-
HA
-
Needs Assessment
-
Bug Fix
-
Fixed an issue with queries filtering with arrays when log-queries is enabled.
-
Needs Assessment
Description
In PDB 7.7.1, if log-queries = true some PDB queries will fail with Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray. This was working in 7.5.2. Disabling log-queries alleviates the issue.
Reproduction
- Install 7.7.1 or PE 2021.4.0
- Set log-queries = true in the jetty.ini
- Run the following query and observe the error
# curl -G http://localhost:8080/pdb/query/v4/facts --data-urlencode 'query=["extract", ["certname", "name", "value"], ["and", ["or", ["in", "certname", ["array", ["somenode"]]]], ["in", "name", ["array", ["aio_agent_version"]]]]]' |
Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray: {"somenode"} |
Impact
This query is generated from bolt, so running bolt against a PE instance in 2021.4.0 with log-queries = true will fail.
# bolt task run facts --targets $(puppet config print certname) --transport pcp
|
Started on pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal... |
Failed on pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal: |
Query to PuppetDB v4/facts failed with query ["extract" ["certname" "name" "value"] ["and" ("or" ["in" "certname" ["array" ("pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal")]]) ["in" "name" ["array" ["aio_agent_version"]]]]]: Cannot JSON encode object of class: class org.postgresql.jdbc.PgArray: {"pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal"} |
Failed on 1 target: pe-server-16712b-0.us-west1-c.c.customer-support-scratchpad.internal |
Ran on 1 target in 0.55 sec |
Workaround
Set log-queries = false or remove the line from the jetty.ini