Merge pull request #11225 from lafirest/fix/pgsql_function_clause

fix(bridge): ensure the username of pgsql must exists
This commit is contained in:
lafirest 2023-07-07 20:39:07 +08:00 committed by GitHub
commit 70bd7a59e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*-
{application, emqx_connector, [
{description, "EMQX Data Integration Connectors"},
{vsn, "0.1.26"},
{vsn, "0.1.27"},
{registered, []},
{mod, {emqx_connector_app, []}},
{applications, [

View File

@ -69,7 +69,7 @@ roots() ->
fields(config) ->
[{server, server()}] ++
emqx_connector_schema_lib:relational_db_fields() ++
adjust_fields(emqx_connector_schema_lib:relational_db_fields()) ++
emqx_connector_schema_lib:ssl_fields() ++
emqx_connector_schema_lib:prepare_statement_fields().
@ -77,6 +77,22 @@ server() ->
Meta = #{desc => ?DESC("server")},
emqx_schema:servers_sc(Meta, ?PGSQL_HOST_OPTIONS).
adjust_fields(Fields) ->
lists:map(
fun
({username, OrigUsernameFn}) ->
{username, fun
(required) ->
true;
(Any) ->
OrigUsernameFn(Any)
end};
(Field) ->
Field
end,
Fields
).
%% ===================================================================
callback_mode() -> always_sync.

View File

@ -0,0 +1 @@
Fix the `username` of PostgreSQL/Timescale/MatrixDB bridges could be empty