You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following script only produces ["users"], instead of ["enrollments", "users"].
require 'pg_query'
require 'pp'
sql = 'select u.email, (select count(*) from enrollments e where e.user_id = u.id) as num_enrollments from users u'
pp PgQuery.parse(sql).tables
The following script only produces ["users"], instead of ["enrollments", "users"].
Given https://github.com/lfittl/pg_query/blob/961411a6741cf40b44a3b3843f89ee4c9ec8f8ad/lib/pg_query/parse.rb#L56-L58, the function will only look at the top-level FROM clause.
Picking apart the targetList, I can find the subquery used in this specific example, and extract the tables it uses:
Here's the original parse tree:
The text was updated successfully, but these errors were encountered: