Issue #13659 has been updated by Daniel Pittman. Status changed from In Topic Branch Pending Review to Merged - Pending Release Target version changed from 2.7.x to 2.7.14
---------------------------------------- Bug #13659: Inventory search for integer fact values produces invalid SQL with Postgres as storeconfig database https://projects.puppetlabs.com/issues/13659#change-60015 Author: Andreas Ntaflos Status: Merged - Pending Release Priority: Normal Assignee: Patrick Carlisle Category: stored configuration Target version: 2.7.14 Affected Puppet version: 2.7.12 Keywords: postgres, stored configs Branch: https://github.com/puppetlabs/puppet/pull/639 Using Puppet 2.7.12, Dashboard 1.2.6, PostgreSQL 8.4 for Puppet storeconfigs and using the Puppet inventory server feature. When using `[master] facts_terminus = inventory_active_record` and the underlying database is PostgreSQL, searching the inventory for facts with integer values produce an invalid SQL query that is rejected by Postgres. For example, when searching for nodes with `processorcount = 2` the following error appears in the puppetmaster logs: Fri Apr 06 01:16:19 +0200 2012 Puppet (err): PGError: ERROR: operator does not exist: text = integer LINE 1: ...cts.name = E'processorcount' AND inventory_facts.value = 2) ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. : SELECT "inventory_nodes".* FROM "inventory_nodes" INNER JOIN "inventory_facts" ON inventory_facts.node_id = inventory_nodes.id WHERE (inventory_facts.name = E'processorcount' AND inventory_facts.value = 2) The Postgres server logs show it a bit better: 2012-04-06 01:16:19 CEST ERROR: operator does not exist: text = integer at character 205 2012-04-06 01:16:19 CEST HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. 2012-04-06 01:16:19 CEST STATEMENT: SELECT "inventory_nodes".* FROM "inventory_nodes" INNER JOIN "inventory_facts" ON inventory_facts.node_id = inventory_nodes.id WHERE (inventory_facts.name = E'processorcount' AND inventory_facts.value = 2) The problem is that integer values need to be enclosed in single quotes for the SQL query (`... AND inventory_facts.value = '2'`) to be valid here. Searching for string fact values ("2.7.12", "Ubuntu", etc) works fine, on the other hand. I guess this is a symptom of Dashboard using MySQL-specific features and creating queries only fully compatible with MySQL? Is there anything else I can provide? -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
