Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 1ac668b

Browse files
committed
Update PgSql.cs
1 parent f237d83 commit 1ac668b

File tree

1 file changed

+3
-4
lines changed
  • src/ServiceStack.OrmLite.PostgreSQL

1 file changed

+3
-4
lines changed

src/ServiceStack.OrmLite.PostgreSQL/PgSql.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ public static NpgsqlParameter Param<T>(string name, T value) =>
1212
public static string Array<T>(params T[] items) =>
1313
"ARRAY[" + PostgreSqlDialect.Provider.SqlSpread(items) + "]";
1414

15-
public static string Array<T>(T[] items, bool nullIfEmpty) => nullIfEmpty
16-
? "ARRAY[" + NullIfEmpty(PostgreSqlDialect.Provider.SqlSpread(items)) + "]"
15+
public static string Array<T>(T[] items, bool nullIfEmpty) =>
16+
nullIfEmpty && items == null || items.Length == 0
17+
? "null"
1718
: "ARRAY[" + PostgreSqlDialect.Provider.SqlSpread(items) + "]";
18-
19-
public static string NullIfEmpty(string sql) => sql == "ARRAY[]" ? "null" : sql;
2019
}
2120
}

0 commit comments

Comments
 (0)