MySQL 1443:是什么意思? [英] MySQL 1443: what does it mean?

查看:239
本文介绍了MySQL 1443:是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MySQL 5.0中进行以下形式的更新:

I'm trying to do an update, in MySQL 5.0, of the form:

update mytable.myfield t
set f = 'blah'
where t.id in (select v.id from myview v where ...);

MySQL告诉我:

ErrorNr. 1443
The definition of table 'v' prevents operation UPDATE on table 't'.

MySQL文档列出了此错误,但(照常)没有说明错误的含义.谁能为我阐明一下?我只引用子查询中的视图,而只引用主查询中的表,但我不知道为什么这些会阻止更新.我在Google上发现的唯一一件事是与触发器相关的MySQL Bug数据库中的一个错误,但是(AFAIK)我的数据库中没有触发器.

The MySQL docs list this error, but (as usual) don't say what it means. Can anyone shed some light on this for me? I only reference the view in the subquery, and I only reference the table in the main query, and I don't know why these would prevent the update. The only thing I found with google is a bug in the MySQL bug db related to triggers, but (AFAIK) there are no triggers in my db.

推荐答案

我认为视图 myview 必须基于表 mytable ,以便对其进行更改到 myfield 时,它将无法跟踪视图中的内容,因此会进行非法更新.

I think the view myview must be based on the table mytable, so that as it makes changes to myfield, it loses track of what's in the view and therefore makes for an illegal update.

我建议您查看myview的定义,以便您可以在不引用查询的情况下编写查询.然后,您也许可以解决这个问题.

I would recommend looking at the definition of myview, so that you can write your query without referencing it. Then you may be able to work it out.

或者,将ID列表转储到临时表中,并将其用于子查询.

Alternatively, dump the list of ids to a temporary table and use that for your subquery.

Rob

这篇关于MySQL 1443:是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆