postgresql 更新错误“错误:布尔类型的输入语法无效:”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13495840/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 23:51:22  来源:igfitidea点击:

postgresql UPDATE error " ERROR: invalid input syntax for type boolean: "

postgresql

提问by themihai

I'm trying to make a simple update query on postgresql. I don't really understand the error as there is no boolean value or column type. Here is the log :

我正在尝试对 postgresql 进行简单的更新查询。我不太明白这个错误,因为没有布尔值或列类型。这是日志:

cat=> UPDATE categories SET epekcategoryid='27af8b1e-c0c9-4084-8304-256b2ae0c8b2' and epekparentcategoryid='root' WHERE categoryId='281' and siteid='0' and categoryparentid='-1';
ERROR:  invalid input syntax for type boolean: "27af8b1e-c0c9-4084-8304-256b2ae0c8b2"
LINE 1: UPDATE categories SET epekcategoryid='27af8b1e-c0c9-4084-830...

The table config :

表配置:

cat=> \d categories;
                Table "public.categories"
        Column        |         Type          | Modifiers 
----------------------+-----------------------+-----------
 categoryid           | character varying(32) | 
 categoryname         | text                  | 
 siteid               | integer               | 
 categoryparentid     | character varying(32) | 
 status               | integer               | default 0
 epekcategoryid       | text                  | 
 epekparentcategoryid | text                  | 
 categorylevel        | character varying(37) | 
 categoryidpath       | character varying(37) | 

回答by Igor Romanchenko

Try:

尝试:

UPDATE categories 
SET epekcategoryid='27af8b1e-c0c9-4084-8304-256b2ae0c8b2',
    epekparentcategoryid='root' 
WHERE categoryId='281' 
  and siteid='0' 
  and categoryparentid='-1';

You must separate fields in SETpart with "," , not with "AND"

您必须SET用“ ,”分隔部分字段,而不是用“ AND