简体   繁体   English

POSTGRES:预期 DEFAULT 表达式的类型为 varchar,但“0”的类型为 int

[英]POSTGRES: expected DEFAULT expression to have type varchar, but '0' has type int

I'm trying to do a 3rd party software installation and I'm getting the error:我正在尝试进行 3rd 方软件安装,但出现错误:

SQL Error DB_ERROR_ERROR: XXUUU: expected DEFAULT expression to have type varchar, but '0' has type int ERROR: XXUUU: expected DEFAULT expression to have type varchar, but '0' has type int

The query that the installation is trying to execute is:安装尝试执行的查询是:

Executed query : create table llx_adherent_type_lang ( rowid SERIAL PRIMARY KEY, fk_type integer DEFAULT 0 NOT NULL, lang varchar(5) DEFAULT 0 NOT NULL, label varchar(255) NOT NULL, description text, email text, import_key varchar(14) DEFAULT NULL ); 

My guess is that the problem has to do with lang varchar(5) DEFAULT 0 NOT NULL part of the query?我的猜测是问题与查询的lang varchar(5) DEFAULT 0 NOT NULL部分有关? Is it because the column is expecting a varchar(5) while the default value is 0 ?是因为该列需要varchar(5)而默认值为0吗? Which is an integer?哪个是整数? Is my way of thinking valid?我的思维方式有效吗?

If I am to fix it does it mean that I just need to find where the query is and change the default value from 0 to "0" ?如果我要修复它是否意味着我只需要找到查询的位置并将默认值从0更改为"0"

change it from 0 to '0' , or as Bengi suggests '' if that makes more sense.将其从0更改为'0' ,或者如 Bengi 建议的''那样更有意义。

In postgresql "0" would be a name (could be used for the name of a table or name of a column etc) but '0' is a string literal(text, char, varchar, etc)在 postgresql 中, "0"将是一个名称(可用于表名或列名等),但'0'是字符串文字(文本、字符、varchar 等)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM