pgsql invalid definition of a numeric type Hint: please specify the precisio

执行pgsql的建表语句报错
报错信息:

invalid definition of a numeric type 
Hint: please specify the precisio

那么说明你在创建数值类型时没有指定精度。

在 PostgreSQL 中,数值类型(numeric type)需要指定精度和位数。精度表示数值的有效位数,位数表示数值的小数位数。

我报错的sql语句

create table test(
	lock_version numeric(12) not null
);

修改后的sql语句

create table test(
	lock_version numeric(12,3) not null
);

如果有多个字段都使用numeric类型,仔细查看是否存在某个字段没指定精度。

注意:在使用数值类型时,请确保提供了适当的精度和位数,以避免出现 “invalid definition of a numeric type” 的错误提示。

结束!!
hy:18


						你认为的都是你自己强加给自己的,其实并没有那么复杂。别想太多,你没那么重要。

猜你喜欢

转载自blog.csdn.net/weixin_49107940/article/details/131537487