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
Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
database connection to MySQL or PostgreSQL, then single file example which initializes
needed data and demonstrates the problem.
import{knex}from"knex";constfakeMain=async()=>{constdb=knex({});awaitdb.table({// for nested query, pg requires to alias sub queries.t: db.select({a: 1,c: db.raw('COUNT(*)'),}),}).select({a: 'a',c: 'c',desc: db.raw('?',['this is my query']),});};
As a workaround, we can put this code to somewhere module-mode ts file to declare this use-case.
Environment
Knex version: 2.4.2 ( and also confirmed with 3.1.0 )
Database + version: pg 14
OS: any
Select applicable template from below.
If issue is about TypeScript definitions, tag @lorefnon.
Bug
knex.table({ t: knex.select(...) })
style select is supported by knex runtime, but not accepted by type def of knex.And renaming sub-queries is necessary for postgres.
database connection to MySQL or PostgreSQL, then single file example which initializes
needed data and demonstrates the problem.
RunKit can't show the type def, so please see this codespace example
As a workaround, we can put this code to somewhere module-mode ts file to declare this use-case.
The text was updated successfully, but these errors were encountered: