- 优化 pgsql15.0 部分类型兼容;#1436

This commit is contained in:
2881099
2023-02-24 21:53:06 +08:00
parent 679cf7efca
commit c6a3ca6d2f
6 changed files with 55 additions and 1 deletions

View File

@ -269,9 +269,21 @@ where ns.nspname = {{0}} and c.relname = {{1}}", tboldname ?? tbname);
var type = string.Concat(a[1]);
var sqlType = string.Concat(a[3]);
var max_length = long.Parse(string.Concat(a[2]));
type = type.Replace("smallint", "int2")
.Replace("integer", "int4")
.Replace("bigint", "int8")
.Replace("real", "float4")
.Replace("double precision", "float8")
.Replace("character varying", "varchar"); //pg15+
sqlType = type.Replace("smallint", "int2")
.Replace("integer", "int4")
.Replace("bigint", "int8")
.Replace("real", "float4")
.Replace("double precision", "float8")
.Replace("character varying", "varchar"); //pg15+
switch (sqlType.ToLower())
{
case "bool": case "name": case "bit": case "varbit": case "bpchar": case "varchar": case "bytea": case "text": case "uuid": break;
case "bool": case "name": case "bit": case "varbit": case "bpchar": case "varchar": case "bytea": case "text": case "uuid":
default: max_length *= 8; break;
}
if (type.StartsWith("_"))