Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDB-5278) Fix group by dotted fact path with forward slash #3573

Open
wants to merge 1 commit into
base: 6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/puppetlabs/puppetdb/query_eng/engine.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@
:field]))
;; Turn facts.foo into a double quoted keyword so that the SQL identifier `:"facts.foo"`
;; matches the extraction of (fs.volatile||fs.stable) AS "facts.foo" from the selection
(keyword (jdbc/double-quote column-or-fn-name))
(htypes/raw (jdbc/double-quote column-or-fn-name))
(or (get-in query-rec [:projections column-or-fn-name :field])
(if (some #{column-or-fn-name} (keys pdb-fns->pg-fns))
(keyword column-or-fn-name)
Expand Down
8 changes: 8 additions & 0 deletions test/puppetlabs/puppetdb/http/inventory_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@
["null?" "facts" true]
#{}

["extract" ["facts.foo"]
["group_by" "facts.foo"]]
#{{:facts.foo nil}}

["extract" ["facts.f/oo"]
["group_by" "facts.f/oo"]]
#{{:facts.f/oo nil}}

["extract" [["function", "count"] "facts.domain"]
["group_by" "facts.domain"]]
#{{:facts.domain "testing.com" :count 2}
Expand Down