登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
46
Star
616
Fork
338
insistence
/
RuoYi-Vue3-FastAPI
代码
Issues
17
Pull Requests
4
Wiki
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
自动生成代码生成的sql脚本执行失败
待办的
#ID0W0D
闲庭信步
创建于
2025-10-08 12:34
您好,我对数据库不熟悉,不确定是生成的sql语句有问题还是我的使用方法不对,AI对错误的解释是 > VALUES 中直接使用聚合函数 max(menu_id) 的写法是非法的,需要把`max(menu_id)`改成子查询`(SELECT MAX(menu_id) FROM sys_menu)` ## 生成的SQL脚本内容是 ``` -- 菜单 SQL insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类', '1', '1', 'category', 'product_category/category/index', 1, 0, 'C', '0', '0', 'product_category:category:list', '#', 'admin', current_timestamp, '', null, '产品分类菜单'); -- 按钮父菜单ID select max(menu_id) from sys_menu; -- 按钮 SQL insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:query', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:add', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:edit', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:remove', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:export', '#', 'admin', current_timestamp, '', null, ''); ``` ## 报错信息 ``` C:\Users\xtsb\AppData\Roaming\DBeaverData\drivers\clients\postgresql\win\17\psql.exe --host=192.168.124.34 --port=5432 --username=root--echo-errors prodb 任务 'PostgreSQL 脚本' 开始于 Wed Oct 08 12:14:49 CST 2025 INSERT 0 1 max ------ 2001 (1 row) ERROR: column "menu_id" does not exist LINE 2: values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:query', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:add', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:edit', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:remove', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:export', '#', 'admin', current_timestamp, '', null, ''); 任务 'PostgreSQL 脚本' 结束于 Wed Oct 08 12:14:49 CST 2025 ```
您好,我对数据库不熟悉,不确定是生成的sql语句有问题还是我的使用方法不对,AI对错误的解释是 > VALUES 中直接使用聚合函数 max(menu_id) 的写法是非法的,需要把`max(menu_id)`改成子查询`(SELECT MAX(menu_id) FROM sys_menu)` ## 生成的SQL脚本内容是 ``` -- 菜单 SQL insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类', '1', '1', 'category', 'product_category/category/index', 1, 0, 'C', '0', '0', 'product_category:category:list', '#', 'admin', current_timestamp, '', null, '产品分类菜单'); -- 按钮父菜单ID select max(menu_id) from sys_menu; -- 按钮 SQL insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:query', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:add', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:edit', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:remove', '#', 'admin', current_timestamp, '', null, ''); insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:export', '#', 'admin', current_timestamp, '', null, ''); ``` ## 报错信息 ``` C:\Users\xtsb\AppData\Roaming\DBeaverData\drivers\clients\postgresql\win\17\psql.exe --host=192.168.124.34 --port=5432 --username=root--echo-errors prodb 任务 'PostgreSQL 脚本' 开始于 Wed Oct 08 12:14:49 CST 2025 INSERT 0 1 max ------ 2001 (1 row) ERROR: column "menu_id" does not exist LINE 2: values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类查询', max(menu_id), '1', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:query', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类新增', max(menu_id), '2', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:add', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类修改', max(menu_id), '3', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:edit', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类删除', max(menu_id), '4', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:remove', '#', 'admin', current_timestamp, '', null, ''); ERROR: column "menu_id" does not exist LINE 2: values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F... ^ HINT: There is a column named "menu_id" in table "sys_menu", but it cannot be referenced from this part of the query. STATEMENT: insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values('产品分类导出', max(menu_id), '5', '#', '', 1, 0, 'F', '0', '0', 'product_category:category:export', '#', 'admin', current_timestamp, '', null, ''); 任务 'PostgreSQL 脚本' 结束于 Wed Oct 08 12:14:49 CST 2025 ```
评论 (
0
)
登录
后才可以发表评论
状态
待办的
待办的
进行中
已完成
已关闭
负责人
未设置
标签
未设置
标签管理
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (2)
标签 (23)
master
develop
v1.7.1
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.1
v1.5.0
v1.4.0
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.2
v1.2.1
v1.2.0
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.3
v1.0.2
v1.0.1
v1.0.0
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
参与者(1)
Python
1
https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI.git
git@gitee.com:insistence2022/RuoYi-Vue3-FastAPI.git
insistence2022
RuoYi-Vue3-FastAPI
RuoYi-Vue3-FastAPI
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册