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

Exception when calling tables method #69

Closed
ankane opened this issue Sep 5, 2017 · 3 comments
Closed

Exception when calling tables method #69

ankane opened this issue Sep 5, 2017 · 3 comments

Comments

@ankane
Copy link

ankane commented Sep 5, 2017

Hey @lfittl, thanks again for this awesome project.

Someone reported a query to me that throws an error with the tables method. Here's the simplest version that reproduces it.

PgQuery.parse("SELECT * FROM pg_catalog.pg_class c JOIN (SELECT 17650 AS oid UNION ALL SELECT 17663 AS oid) vals ON c.oid = vals.oid").tables

Backtrace

NoMethodError: undefined method `map' for nil:NilClass
	from /Users/andrew/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:208:in `block in load_tables_and_aliases!'
	from /Users/andrew/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:186:in `loop'
	from /Users/andrew/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:186:in `load_tables_and_aliases!'
	from /Users/andrew/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:59:in `tables_with_types'
	from /Users/andrew/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:33:in `tables'
	from (irb):14
	from /Users/andrew/.rbenv/versions/2.4.1/bin/irb:11:in `<main>'
@lfittl lfittl closed this as completed in c86323c Sep 5, 2017
@lfittl
Copy link
Member

lfittl commented Sep 5, 2017

@ankane Thanks for the report :)

Just fixed this in c86323c and released as 0.13.3 on Rubygems

@ankane
Copy link
Author

ankane commented Sep 5, 2017

Awesome, that was super quick. Thanks!

@ankane
Copy link
Author

ankane commented Sep 5, 2017

On a related note, very thankful for the tables method. It's super helpful, and very non-trivial from the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants