openGauss进行InitTable时如果有DefaultValue,会报错Sequence contains no 返回
当实体字段有DefaultValue 时,InitTables会报Sequence contains no错误。
[SugarColumn(ColumnDescription = "父Id", ColumnName = "FatherID", IsNullable = true, DefaultValue = "0")]
另外,当表存在时,会貌似sqlsugar会继续创建不会判断,导致报错。
SqlSugar.SqlSugarException: 42P07: relation "sysmenu" already exists in schema "gaussdb"
热忱回答(2)
-
fate sta VIP0
2025/12/24AOP发一下报错SQL
0 回复 -
winnyrain VIP0
2025/12/26@fate sta:
注:实体SysRole库的别名为T_Role
select
kcu.column_name as key_column
from information_schema.table_constraints tco
join information_schema.key_column_usage kcu
on kcu.constraint_name = tco.constraint_name
and kcu.constraint_schema = tco.constraint_schema
and kcu.constraint_name = tco.constraint_name
where tco.constraint_type = 'PRIMARY KEY'
and kcu.table_schema='public' and
upper(kcu.table_name)=upper('T_Role')
fail: 2025-12-26 17:19:39.1860447 +08:00 Friday L System.Logging.StringLogging[0] #7
初始化表结构异常 xx.SysRole Sequence contains no elements
0 回复