Fix some queries to work with older PostgreSQL and MySQL

This commit is contained in:
Alexey Shchepin 2023-09-28 18:40:58 +03:00
parent 7309f9f88a
commit 408f6c4d14
1 changed files with 4 additions and 4 deletions

View File

@ -221,7 +221,7 @@ table_exists(Host, Table) ->
fun(pgsql, _) ->
case
ejabberd_sql:sql_query_t(
?SQL("select @()b exists (select from pg_tables "
?SQL("select @()b exists (select * from pg_tables "
" where tablename=%(Table)s)"))
of
{selected, [{Res}]} ->
@ -460,14 +460,14 @@ format_default(sqlite, _DBVersion, Column) ->
end;
format_default(mysql, _DBVersion, Column) ->
case Column#sql_column.type of
text -> <<"''">>;
{text, _} -> <<"''">>;
text -> <<"('')">>;
{text, _} -> <<"('')">>;
bigint -> <<"0">>;
integer -> <<"0">>;
smallint -> <<"0">>;
numeric -> <<"0">>;
boolean -> <<"false">>;
blob -> <<"''">>;
blob -> <<"('')">>;
timestamp -> <<"CURRENT_TIMESTAMP">>
%{char, N} -> <<"''">>;
%bigserial -> <<"0">>