From 8cc76b5f2fde9e664221832ab414c23ac9af3dfd Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 26 Nov 2020 14:39:05 +0000 Subject: [PATCH] [Minor] Clickhouse: one more text related fix --- lualib/lua_clickhouse.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lualib/lua_clickhouse.lua b/lualib/lua_clickhouse.lua index 4e20229b0..42dba7dc8 100644 --- a/lualib/lua_clickhouse.lua +++ b/lualib/lua_clickhouse.lua @@ -60,9 +60,12 @@ end -- Converts an array to a string suitable for clickhouse local function array_to_string(ar) for i,elt in ipairs(ar) do - if type(elt) == 'string' then - ar[i] = '\'' .. clickhouse_quote(elt) .. '\'' - elseif type(elt) == 'number' then + local t = type(elt) + if t == 'string' then + ar[i] = string.format('\'%s\'', clickhouse_quote(elt)) + elseif t == 'userdata' then + ar[i] = string.format('\'%s\'', clickhouse_quote(tostring(elt))) + elseif t == 'number' then ar[i] = ch_number(elt) end end -- 2.39.5