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
{{ message }}
Repository navigation
when using star in the select of a subquery, the columns aren't available to queries making use of the subquery #377
Notice that user.id is used in the select of the limit subQuery in the working example. In the one that errors user.star() is used in the select of the limit subQuery.
Works
sql.define({name: 'user',columns: ['id','name','email','lastLogin']})varlimit=user.subQuery('limit-users').select(user.id)limit.toString()// (SELECT "user".* FROM "user") "limit-users"sql.select(limit.id,sql.constant(true).as("c")).from(limit).toString()// SELECT "limit-users"."id", TRUE AS "c" FROM (SELECT "user"."id" FROM "user") "limit-users"
Errors
sql.define({name: 'user',columns: ['id','name','email','lastLogin']})varlimit=user.subQuery('limit-users').select(user.star())// ALSO results in error: var limit = user.subQuery('limit-users')limit.toString()// (SELECT "user".* FROM "user") "limit-users"sql.select(limit.id,sql.constant(true).as("c")).from(limit).toString()
AssertionError [ERR_ASSERTION]: Error while trying to add a non-existant node to a query
at constructor.Node.add (/lalitkapoor/pg-team/node_modules/sql/lib/node/index.js:17:3)
at constructor.Node.addAll (/lalitkapoor/pg-team/node_modules/sql/lib/node/index.js:78:10)
at constructor.select (/lalitkapoor/pg-team/node_modules/sql/lib/node/query.js:98:12)
at Sql.select (/lalitkapoor/pg-team/node_modules/sql/lib/index.js:51:16)
at repl:1:5
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at REPLServer.defaultEval (repl.js:239:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:433:10)
changed the title [-]when using star in the select of a subquery, the columns aren't available to queries making use of the sub-query[/-][+]when using star in the select of a subquery, the columns aren't available to queries making use of the subquery[/+]on Oct 11, 2017
Activity
[-]when using star in the select of a subquery, the columns aren't available to queries making use of the sub-query[/-][+]when using star in the select of a subquery, the columns aren't available to queries making use of the subquery[/+]