Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-2892

Nested implicit subqueries fail unless trivial

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 4.2.0
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Basically, if you have nested subqueries, if the query for the middle one is anything other than just a wrapper around the deepest one, PDB fails saying "No implicit relationship for entity 'foo'". This seems to be true for any valid relationship. This happens when submitting both an AST query or a PQL query. Examples:

      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=nodes { certname = "bar" and resources { type = "Foo" } }'
      []
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=facts [value] { name = "fqdn" and nodes { resources { type = "Foo" } } }'
      []
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=facts { name = "fqdn" and nodes { certname = "bar" and resources { type = "Foo" } } }'
      No implicit relationship for entity 'resources'
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=["from", "facts", ["and", ["=", "name", "fqdn"], ["subquery", "nodes", ["subquery", "resources", ["=", "type", "Foo"]]]]]'
      []
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=["from", "facts", ["and", ["=", "name", "fqdn"], ["subquery", "nodes", ["and", ["=", "certname", "bar"], ["subquery", "resources", ["=", "type", "Foo"]]]]]]'
      No implicit relationship for entity 'resources'
       
      # this one is kind of weird
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=["from", "facts", ["and", ["=", "name", "fqdn"], ["subquery", "nodes", ["and", ["subquery", "facts", ["=", "name", "foo"]]]]]]'
      No implicit relationship for entity 'facts'
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=reports { environments { resources { type = "Foo" } } }'
      []
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=reports { environments { name = "bar" and resources { type = "Foo" } } }'
      No implicit relationship for entity 'resources'
       
      [rw@pe-mom2-test ~]curl -sXGET localhost:8080/pdb/query/v4 -d 'query=facts { name = "foo" and nodes { facts { name = "bar" } } }'
      []
       
      [rw@pe-mom2-test ~]$ curl -sXGET localhost:8080/pdb/query/v4 -d 'query=facts { name = "foo" and nodes { certname = "baz" and facts { name = "bar" } } }'
      No implicit relationship for entity 'facts'
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lexa Lexa Whitehurst
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support