diff --git a/Src/Asp.Net/SqlSugar/Realization/Kdbndp/KdbndpSQLProvider.cs b/Src/Asp.Net/SqlSugar/Realization/Kdbndp/KdbndpSQLProvider.cs index 32f0a6875..18eea5bff 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Kdbndp/KdbndpSQLProvider.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Kdbndp/KdbndpSQLProvider.cs @@ -145,7 +145,17 @@ namespace SqlSugar } return result; } - + public override Action ErrorEvent => it => + { + if (base.ErrorEvent != null) + { + base.ErrorEvent(it); + } + if (it.Message != null && it.Message.StartsWith("42883:")) + { + Check.ExceptionEasy(it.Message, $"使用uuid_generate_v4()函数需要创建 CREATE EXTENSION IF NOT EXISTS kbcrypto;CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\" "); + } + }; static readonly Dictionary ArrayMapping = new Dictionary() { diff --git a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs index f391e04b0..37848b35f 100644 --- a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs +++ b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs @@ -228,6 +228,17 @@ namespace SqlSugar parameter.Value = Convert.ToInt64(parameter.Value); } } + public override Action ErrorEvent => it => + { + if (base.ErrorEvent != null) + { + base.ErrorEvent(it); + } + if (it.Message != null && it.Message.StartsWith("42883:")) + { + Check.ExceptionEasy(it.Message, $"使用uuid_generate_v4()函数需要创建 CREATE EXTENSION IF NOT EXISTS pgcrypto;CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\" "); + } + }; static readonly Dictionary ArrayMapping = new Dictionary() {