Skip to content

Commit

Permalink
Fix some queries to work with older PostgreSQL and MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyshch committed Sep 28, 2023
1 parent 7309f9f commit 408f6c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ejabberd_sql_schema.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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}]} ->
Expand Down Expand Up @@ -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">>
Expand Down

0 comments on commit 408f6c4

Please sign in to comment.