Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query failed while parsing data for json column #102

Closed
LalitLab opened this issue Sep 30, 2021 · 2 comments
Closed

Query failed while parsing data for json column #102

LalitLab opened this issue Sep 30, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@LalitLab
Copy link

LalitLab commented Sep 30, 2021

Note: Requires GitHub plugin to reproduce the issue.

The below query failed for the commit 76ffc09

select
  sha,
  author_login,
  author_date, message
from
  github_commit
where
  repository_full_name = 'turbot/steampipe' and sha = '76ffc09a340612b2831efcbf3a8488b2f6360104';

It failed specifically while parsing commit field to jsonb.
{Name: "commit", Type: proto.ColumnType_JSON, Description: "Commit details."},

Steampipe query logs

2021-09-30 11:20:14.467 GMT [86758] ERROR:  invalid input syntax for type json
2021-09-30 11:20:14.467 GMT [86758] DETAIL:  Escape sequence "\'" is invalid.
2021-09-30 11:20:14.467 GMT [86758] CONTEXT:  JSON data, line 1: ...pe-postgre-fdw to v0.2.2 - fix JSON data with '\'...

Raw data for commit from API

{
  "sha": "76ffc09a340612b2831efcbf3a8488b2f6360104",
  "node_id": "MDY6Q29tbWl0MzMwNDA1MTg0Ojc2ZmZjMDlhMzQwNjEyYjI4MzFlZmNiZjNhODQ4OGIyZjYzNjAxMDQ=",
  "url": "https://api.github.com/repos/turbot/steampipe/git/commits/76ffc09a340612b2831efcbf3a8488b2f6360104",
  "html_url": "https://github.com/turbot/steampipe/commit/76ffc09a340612b2831efcbf3a8488b2f6360104",
  "author": {
    "name": "kai",
    "email": "kai@turbot.com",
    "date": "2021-09-08T14:10:22Z"
  },
  "committer": {
    "name": "kai",
    "email": "kai@turbot.com",
    "date": "2021-09-08T14:10:22Z"
  },
  "tree": {
    "sha": "d38ec7a3e6fc07129743aae158596cc0acb72796",
    "url": "https://api.github.com/repos/turbot/steampipe/git/trees/d38ec7a3e6fc07129743aae158596cc0acb72796"
  },
  "message": "Update steampipe-postgre-fdw to v0.2.2 - fix JSON data with '\\u0000' resulting in Postgres error \"unsupported Unicode escape sequence\".",
  "parents": [
    {
      "sha": "199206089d1a1cff81c34c49bb4d1faa3cc85e41",
      "url": "https://api.github.com/repos/turbot/steampipe/git/commits/199206089d1a1cff81c34c49bb4d1faa3cc85e41",
      "html_url": "https://github.com/turbot/steampipe/commit/199206089d1a1cff81c34c49bb4d1faa3cc85e41"
    }
  ],
  "verification": {
    "verified": false,
    "reason": "unsigned",
    "signature": null,
    "payload": null
  }
}
@LalitLab LalitLab added the bug Something isn't working label Sep 30, 2021
@LalitLab
Copy link
Author

@judell
Copy link
Contributor

judell commented Oct 7, 2021

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants