Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] Queries return parse error when using a table alias

未关闭
#425 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
领域
database

调研方向

报告中没有确定任何仓库文件、测试或入口点。首先使用 node-odbc 2.4.9、MDBTools 和 Access 重现带别名的查询和连接查询,然后将它们与可正常工作的查询及 DBeaver 的结果进行比较。当报告中的查询能够在不出现 ODBC 错误的情况下完成解析和执行,或清楚地记录驱动程序边界时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Describe your system

  • odbc Package Version: [email protected]
  • ODBC Driver: MDBTools
  • Database Name: Access
  • Database Version: uncertain
  • Database OS: running through kubuntu using ODBC
  • Node.js Version: v20.15.0
  • Node.js OS: kubuntu 24.04

Describe the bug
I have this code:
const odbc = require('odbc'); const connection = odbc.connect('DSN=my_db', (error, connection) => { connection.query('select * from Objects limit 10', (error, result) => { if (error) { console.error(error) } console.log(result.columns) }); });

which works with no issues. However, if I modify the query with an alias like:

'select * from Objects a1a limit 10'

I get this error:

Got no result for 'select * from Objects a1a limit 10' command [Error: [odbc] Error executing the sql statement] { odbcErrors: [ { state: '', code: 1, message: "Couldn't parse SQL\n" } ] }

In addition, if I put any joins in the query I get the exact same error. For example:

select objects.ID, objects.Object, objects.CardID, objects.SetID, objects.Name, sets.name as set_name from Objects inner join sets on sets.id = Objects.setid where sets.name in ('The Awesome Planet') limit 10

If I run these same queries in DBeaver they return data with no errors.

Expected behavior
The query to parse with no errors.

To Reproduce
Steps to reproduce the behavior:
Described above.

  • The offending code:
  • Any DEBUG information printed to the terminal: Described above
  • Any error information returned from a function call: Described above
主要语言
JavaScript
星标
159
派生
92
平均合并
3 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

IBM/node-odbc 的其他 Issue

查看 IBM/node-odbc 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。