You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Edgedb链接更新失败:禁止修改计算型链接问题求助

问题原因

你在with子句的查询中,显式指定了class的嵌套返回字段(id, name, year),这会让student_to_update变量里的class变成一个计算链接(computed link),而非原始的可修改链接字段,因此更新操作会被禁止。

正确查询写法

不需要在前置查询中嵌套获取class的详细字段,直接选中Student对象本身即可:

with student_to_update := (
    select Student
    filter .id = <uuid>$student_id
)
update student_to_update
set {class := (select Class filter .id = <uuid>$class_id)};

或者更简化的写法,直接在update语句中过滤目标学生:

update Student
filter .id = <uuid>$student_id
set {class := (select Class filter .id = <uuid>$class_id)};

说明

当你在select语句中定义class: {id, name, year}时,相当于创建了一个临时的计算属性,覆盖了Student类型原本的class链接字段。这种临时计算字段是只读的,无法通过update修改。只要保持查询返回的是原始的Student对象(不额外定义嵌套字段),就能正常修改其class链接。

内容的提问来源于stack exchange,提问作者Alexey Sherchenkov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 16:25:53