diff --git a/Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs b/Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs index 829ccf7d7..6748569f3 100644 --- a/Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs +++ b/Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs @@ -43,7 +43,7 @@ namespace OrmTest db.Queryable().AddQueue(); db.Queryable().AddQueue(); - db.AddQueue("select * from [Order] where id=@id", new { id = 10000 }); + db.AddQueue("select * from \"order\" where id=@id", new { id = 10000 }); var result2 = db.SaveQueues(); Console.WriteLine("#### Queue End ####"); diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs b/Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs index 5f3a431cb..5ce737a52 100644 --- a/Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs +++ b/Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs @@ -48,9 +48,9 @@ namespace OrmTest task8.Wait(); UValidate.Check(8, task8.Result[0].id, "ado"); - var task9=Db.Ado.SqlQuery("select * from [order];select * from OrderDetail"); + var task9=Db.Ado.SqlQuery("select * from \"order\";select * from OrderDetail"); - var task10 = Db.Ado.SqlQueryAsync("select * from [order];select * from OrderDetail"); + var task10 = Db.Ado.SqlQueryAsync("select * from \"order\";select * from OrderDetail"); task10.Wait(); } } diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs b/Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs index 3c853a7d5..ab92b7f92 100644 --- a/Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs +++ b/Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs @@ -18,7 +18,7 @@ namespace OrmTest { [SqlSugar.SugarColumn(IndexGroupNameList = new string[] { "group1" })] public int Id { get; set; } - [SqlSugar.SugarColumn(DefaultValue="getdate()", IndexGroupNameList =new string[] {"group1" } )] + [SqlSugar.SugarColumn(DefaultValue="now()", IndexGroupNameList =new string[] {"group1" } )] public DateTime? CreateDate { get; set; } } } diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs b/Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs index 8b8f664a0..daf55b4b7 100644 --- a/Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs +++ b/Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs @@ -16,7 +16,7 @@ namespace OrmTest Db.Insertable(new JsonTest() { Order = new Order { Id = 1, Name = "order1" } }).ExecuteCommand(); var list = Db.Queryable().ToList(); UValidate.Check("order1", list.First().Order.Name, "Json"); - Db.Updateable(new JsonTest() { Id = 1, Order = new Order { Id = 2, Name = "order2" } }).ExecuteCommand(); + var x=Db.Updateable(new JsonTest() { Id = Db.Queryable().Max(it => it.Id), Order = new Order { Id = Db.Queryable().Max(it=>it.Id), Name = "order2" } }).ExecuteCommand(); list= Db.Queryable().ToList(); UValidate.Check("order2", list.First().Order.Name, "Json"); var list2 = Db.Queryable().ToList(); @@ -28,7 +28,7 @@ namespace OrmTest { [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } - [SqlSugar.SugarColumn(ColumnDataType = "varchar(max)", IsJson = true)] + [SqlSugar.SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)] public Order Order { get; set; } } } diff --git a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs index 60b861050..42a9c244c 100644 --- a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs @@ -220,21 +220,21 @@ namespace SqlSugar { get { - return ""; + return "CREATE INDEX Index_{0}_{2} ON {0} ({1})"; } } protected override string AddDefaultValueSql { get { - return ""; + return "ALTER TABLE {0} ALTER COLUMN {1} SET DEFAULT {2}"; } } protected override string IsAnyIndexSql { get { - return "select count(*) from sys.indexes where name='{0}'"; + return " SELECT count(1) FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace where relname = '{0}'"; } } #endregion