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

Look into behavior of how pql parses datetimes

    XMLWordPrintable

    Details

    • Template:
    • Team:
      PuppetDB
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      When an invalid / malformed timestamp was passed in a PQL query, it was treated as a null, giving back an unexpected query result. The timestamp is now validated, and an error is returned to the user.
    • QA Risk Assessment:
      Needs Assessment

      Description

      It looks like the parser used for pql queries here will fail silently if unable to parse a datetime string in a pql query. This results in the query being built up getting NULL values for the params which are supposed to contain a datetime. We should figure out if this is the intended behavior or if it would make more sense to return a validation error to the person making the query. 

       

      You can reproduce this issue by setting up pdb with some fake data using the benchmark command. Then make sure to restart your postgres instance with the log_statement setting set to 'all' in the postgres.conf file. Then look at the differences in output from the queries below. 

       

      Invalid datetime string: 

      puppet-query "nodes { catalog_timestamp > '2018-08-15 21:11:21 UTC'}" 

       

      valid datetime string: 

       puppet-query "nodes { catalog_timestamp > '2018-08-15 21:11:21Z'}" 

       

       

       

       

        Attachments

          Activity

            People

            Assignee:
            robert.roland Robert Roland
            Reporter:
            zachary.kent Zachary Kent
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support