Jira (PDB-4493) Query function count() broken for JSON fields

2019-09-05 Thread Austin Blatt (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Austin Blatt updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 PuppetDB /  PDB-4493  
 
 
  Query function count() broken for JSON fields   
 

  
 
 
 
 

 
Change By: 
 Austin Blatt  
 

  
 
 
 
 

 
 For a query like{code}  facts[name, count(value)] {  certname ~ "^pe.*"  group by name}{code}The query engine currently constructs an SQL SELECT that looks like{code}  SELECTfs.key AS name,  count((value#>>'{}')::numeric)count{code}  Which causes the error{code}  javax.servlet.ServletException: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type numeric: "root"{code} But the The  argument to count is invalid and it should be closer to{code}  SELECTfs.key AS name,  count(value)count{code}  *_NOTE_: The error will only happen if the table has data.*   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails 

Jira (PDB-4493) Query function count() broken for JSON fields

2019-09-05 Thread Austin Blatt (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Austin Blatt created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 PuppetDB /  PDB-4493  
 
 
  Query function count() broken for JSON fields   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Affects Versions: 
 PDB 6.5.0, PDB 6.3.4, PDB 5.2.9  
 
 
Assignee: 
 Unassigned  
 
 
Created: 
 2019/09/05 2:43 PM  
 
 
Priority: 
  Normal  
 
 
Reporter: 
 Austin Blatt  
 

  
 
 
 
 

 
 For a query like  
 
 
 
 
 facts[name, count(value)] {  
 
 
   certname ~ "^pe.*"  
 
 
   group by name  
 
 
 }
  
 
 
 
  The query engine currently constructs an SQL SELECT that looks like  
 
 
 
 
 SELECT