mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
fix: compatibility between GENERATED and SERIAL auto-increment fields in PostgreSQL version 10 and above
This commit is contained in:
parent
64e86eaebd
commit
38f2cec25d
@ -30,8 +30,11 @@ namespace SqlSugar
|
|||||||
col_description(pclass.oid, pcolumn.ordinal_position) as ColumnDescription,
|
col_description(pclass.oid, pcolumn.ordinal_position) as ColumnDescription,
|
||||||
case when pkey.colname = pcolumn.column_name
|
case when pkey.colname = pcolumn.column_name
|
||||||
then true else false end as IsPrimaryKey,
|
then true else false end as IsPrimaryKey,
|
||||||
case when pcolumn.column_default like 'nextval%'
|
CASE
|
||||||
then true else false end as IsIdentity,
|
WHEN (current_setting('server_version_num')::INT >= 100000 AND pcolumn.is_identity = 'YES') THEN true
|
||||||
|
WHEN pcolumn.column_default LIKE 'nextval%' THEN true
|
||||||
|
ELSE false
|
||||||
|
END AS IsIdentity,
|
||||||
case when pcolumn.is_nullable = 'YES'
|
case when pcolumn.is_nullable = 'YES'
|
||||||
then true else false end as IsNullable
|
then true else false end as IsNullable
|
||||||
from (select * from pg_tables where upper(tablename) = upper('{0}') and schemaname='" + schema + @"') ptables inner join pg_class pclass
|
from (select * from pg_tables where upper(tablename) = upper('{0}') and schemaname='" + schema + @"') ptables inner join pg_class pclass
|
||||||
|
Loading…
Reference in New Issue
Block a user