Skip to content

Instantly share code, notes, and snippets.

@lfittl
Last active September 25, 2019 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfittl/e2e213c8a362e8e7f0a9 to your computer and use it in GitHub Desktop.
Save lfittl/e2e213c8a362e8e7f0a9 to your computer and use it in GitHub Desktop.
require 'pg_query'
pp PgQuery.parse("SELECT 1")
#<PgQuery:0x007f8cdaa8f8b8
@parsetree=
[{"SELECT"=>
{"distinctClause"=>nil,
"intoClause"=>nil,
"targetList"=>
[{"RESTARGET"=>
{"name"=>nil,
"indirection"=>nil,
"val"=>{"A_CONST"=>{"val"=>1, "location"=>7}},
"location"=>7}}],
"fromClause"=>nil,
"whereClause"=>nil,
"groupClause"=>nil,
"havingClause"=>nil,
"windowClause"=>nil,
"valuesLists"=>nil,
"sortClause"=>nil,
"limitOffset"=>nil,
"limitCount"=>nil,
"lockingClause"=>nil,
"withClause"=>nil,
"op"=>0,
"all"=>false,
"larg"=>nil,
"rarg"=>nil}}],
@query="SELECT 1",
@warnings=[]>
@j-d
Copy link

j-d commented Mar 14, 2018

Hi!. The first line says pq_query . (Q instead of G). It would be great if you could change it because we just copy+pasted and we have been scratching our heads for a while 😅

@lfittl
Copy link
Author

lfittl commented Sep 25, 2019

@j-d Late response, but this is fixed now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment