- 修复 pgsql dbfirst 未处理数组类型生成的问题;

This commit is contained in:
28810 2020-06-30 01:34:38 +08:00
parent 68981d03ac
commit 806c826187
7 changed files with 33 additions and 4 deletions

View File

@ -125,6 +125,13 @@
清空状态数据 清空状态数据
</summary> </summary>
</member> </member>
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
<summary>
根据 lambda 条件删除数据
</summary>
<param name="predicate"></param>
<returns></returns>
</member>
<member name="M:FreeSql.DbSet`1.Add(`0)"> <member name="M:FreeSql.DbSet`1.Add(`0)">
<summary> <summary>
添加 添加
@ -479,5 +486,14 @@
<param name="that"></param> <param name="that"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
<summary>
批量注入 Repository可以参考代码自行调整
</summary>
<param name="services"></param>
<param name="globalDataFilter"></param>
<param name="assemblies"></param>
<returns></returns>
</member>
</members> </members>
</doc> </doc>

View File

@ -1,5 +1,6 @@
using FreeSql.DataAnnotations; using FreeSql.DataAnnotations;
using System; using System;
using System.Linq;
using Xunit; using Xunit;
namespace FreeSql.Tests.PostgreSQL namespace FreeSql.Tests.PostgreSQL
@ -20,6 +21,8 @@ namespace FreeSql.Tests.PostgreSQL
var t2 = g.pgsql.DbFirst.GetTablesByDatabase(g.pgsql.DbFirst.GetDatabases()[1]); var t2 = g.pgsql.DbFirst.GetTablesByDatabase(g.pgsql.DbFirst.GetDatabases()[1]);
var tb_alltype = t2.Where(a => a.Name == "tb_alltype").FirstOrDefault();
} }
} }
} }

View File

@ -16,6 +16,10 @@ using kwlib;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Newtonsoft.Json;
using System.Net.NetworkInformation;
using System.Net;
using System.Collections;
namespace FreeSql.Tests namespace FreeSql.Tests
{ {
@ -502,3 +506,5 @@ namespace FreeSql.Tests
} }
} }

View File

@ -220,7 +220,7 @@ case when a.atttypmod > 0 and a.atttypmod < 32767 then a.atttypmod - 4 else a.at
case when t.typelem = 0 then t.typname else t2.typname end, case when t.typelem = 0 then t.typname else t2.typname end,
case when a.attnotnull then 0 else 1 end as is_nullable, case when a.attnotnull then 0 else 1 end as is_nullable,
--e.adsrc as is_identity, pg12以下 --e.adsrc as is_identity, pg12以下
(select sys_get_expr(adbin, adrelid) from sys_attrdef where adrelid = e.adrelid limit 1) is_identity, (select sys_get_expr(adbin, adrelid) from sys_attrdef where adrelid = e.adrelid and adnum = e.adnum limit 1) is_identity,
d.description as comment, d.description as comment,
a.attndims, a.attndims,
case when t.typelem = 0 then t.typtype else t2.typtype end, case when t.typelem = 0 then t.typtype else t2.typtype end,
@ -274,6 +274,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break; case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break;
} }
} }
if (attndims > 0) type += "[]";
loc3[object_id].Add(column, new DbColumnInfo loc3[object_id].Add(column, new DbColumnInfo
{ {

View File

@ -212,7 +212,7 @@ case when a.atttypmod > 0 and a.atttypmod < 32767 then a.atttypmod - 4 else a.at
case when t.typelem = 0 then t.typname else t2.typname end, case when t.typelem = 0 then t.typname else t2.typname end,
case when a.attnotnull then 0 else 1 end as is_nullable, case when a.attnotnull then 0 else 1 end as is_nullable,
--e.adsrc as is_identity, pg12以下 --e.adsrc as is_identity, pg12以下
(select pg_get_expr(adbin, adrelid) from pg_attrdef where adrelid = e.adrelid limit 1) is_identity, (select pg_get_expr(adbin, adrelid) from pg_attrdef where adrelid = e.adrelid and adnum = e.adnum limit 1) is_identity,
d.description as comment, d.description as comment,
a.attndims, a.attndims,
case when t.typelem = 0 then t.typtype else t2.typtype end, case when t.typelem = 0 then t.typtype else t2.typtype end,
@ -266,6 +266,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break; case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break;
} }
} }
if (attndims > 0) type += "[]";
loc3[object_id].Add(column, new DbColumnInfo loc3[object_id].Add(column, new DbColumnInfo
{ {

View File

@ -322,7 +322,7 @@ case when a.atttypmod > 0 and a.atttypmod < 32767 then a.atttypmod - 4 else a.at
case when t.typelem = 0 then t.typname else t2.typname end, case when t.typelem = 0 then t.typname else t2.typname end,
case when a.attnotnull then 0 else 1 end as is_nullable, case when a.attnotnull then 0 else 1 end as is_nullable,
--e.adsrc as is_identity, pg12以下 --e.adsrc as is_identity, pg12以下
(select pg_get_expr(adbin, adrelid) from pg_attrdef where adrelid = e.adrelid limit 1) is_identity, (select pg_get_expr(adbin, adrelid) from pg_attrdef where adrelid = e.adrelid and adnum = e.adnum limit 1) is_identity,
d.description as comment, d.description as comment,
a.attndims, a.attndims,
case when t.typelem = 0 then t.typtype else t2.typtype end, case when t.typelem = 0 then t.typtype else t2.typtype end,
@ -376,6 +376,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break; case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break;
} }
} }
if (attndims > 0) type += "[]";
loc3[object_id].Add(column, new DbColumnInfo loc3[object_id].Add(column, new DbColumnInfo
{ {

View File

@ -232,7 +232,7 @@ case when a.atttypmod > 0 and a.atttypmod < 32767 then a.atttypmod - 4 else a.at
case when t.typelem = 0 then t.typname else t2.typname end, case when t.typelem = 0 then t.typname else t2.typname end,
case when a.attnotnull then 0 else 1 end as is_nullable, case when a.attnotnull then 0 else 1 end as is_nullable,
--e.adsrc as is_identity, pg12以下 --e.adsrc as is_identity, pg12以下
(select sys_get_expr(adbin, adrelid) from sys_attrdef where adrelid = e.adrelid limit 1) is_identity, (select sys_get_expr(adbin, adrelid) from sys_attrdef where adrelid = e.adrelid and adnum = e.adnum limit 1) is_identity,
d.description as comment, d.description as comment,
a.attndims, a.attndims,
case when t.typelem = 0 then t.typtype else t2.typtype end, case when t.typelem = 0 then t.typtype else t2.typtype end,
@ -286,6 +286,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break; case "bpchar": case "varchar": case "bytea": case "bit": case "varbit": sqlType += $"({max_length})"; break;
} }
} }
if (attndims > 0) type += "[]";
loc3[object_id].Add(column, new DbColumnInfo loc3[object_id].Add(column, new DbColumnInfo
{ {