[PDB-1043] top-level extract should support short-hand query syntax, or at least throw a reasonable error Created: 2014/11/25  Updated: 2016/04/27  Resolved: 2014/12/16

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: PDB 3.0.0
Fix Version/s: PDB 3.0.0

Type: Bug Priority: Normal
Reporter: Wyatt Alt Assignee: Andrii Nikitiuk
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PDB-1065 make shorthand syntax queries work in... Accepted
Template:
Epic Link: Query Inconsistencies Phase 2
Story Points: 3
Sprint: PuppetDB 2014-12-17

 Description   

This query:

curl -X GET http://localhost:8080/v4/resources --data-urlencode 'query=["extract",["parameter","name"],["~","certname",".*"]]'

causes a postgres exception:

org.postgresql.util.PSQLException: ERROR: column resources.name does not exist

This query:

curl -X GET http://localhost:8080/v4/facts --data-urlencode 'query=["extract",["fact","uptime_hours"],["~","certname",".*"]]'

is broken in a different way, but should also be supported. Current response is this:

[ { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }]



 Comments   
Comment by Andrii Nikitiuk [ 2014/11/26 ]

Accoring to https://docs.puppetlabs.com/puppetdb/2.2/api/query/v4/operators.html#extract :
An extract statement does not constitute a full query string. It may only be used as the second argument of an in statement.

Do we need to change that? What is the desired behaviour for this top-level extract?

Comment by Ken Barber [ 2014/11/26 ]

Actually extract now works at the top level: https://docs.puppetlabs.com/puppetdb/master/api/query/v4/operators.html#extract

Comment by Ken Barber [ 2014/11/26 ]

I fixed the documentation as well, so that absolute statement about extract is removed.

Comment by Andrii Nikitiuk [ 2014/11/28 ]

As I understand here we are just missing validation for "extract" fields names.
Am I right?

Comment by Andrii Nikitiuk [ 2014/12/03 ]

I implemented a validation for the examples described here locally. May I assign this ticket to myself?

Comment by Ken Barber [ 2014/12/03 ]

Sure go ahead .

Generated at Thu Jun 20 02:39:41 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.