From 7ab5f4938bd6169304398b2518aa6a331f390e41 Mon Sep 17 00:00:00 2001 From: Denis Smirnov <sd@picodata.io> Date: Sat, 23 Apr 2022 19:29:28 +0700 Subject: [PATCH] sql: fix string dequoting Previously, select "t1"."a" from (select "a" from "t") as "t1"; returned a result column name `t1` instead of `t1.a` because of incorrect work of a dequoting function. The reason was that previously sqlDequote() function finished its work when found the first closing quote. Old logic worked for simple selects where the column name doesn't contain an explicit scan name ("a" -> a). But for the sub-queries results sqlDequote() finished its work right after the scan name ("t1"."a" -> t1). Now the function continues its deqouting till it gets the null terminator at the end of the string. Closes #7063 NO_DOC=don't change any public API, only a bug fix Co-authored-by: Mergen Imeev <imeevma@gmail.com> --- changelogs/unreleased/fix-string-dequoting.md | 4 ++++ test/sql-luatest/gh_7063_dequote_test.lua | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/fix-string-dequoting.md diff --git a/changelogs/unreleased/fix-string-dequoting.md b/changelogs/unreleased/fix-string-dequoting.md new file mode 100644 index 0000000000..01f28ce410 --- /dev/null +++ b/changelogs/unreleased/fix-string-dequoting.md @@ -0,0 +1,4 @@ +## bugfix/sql + +* SQL queries with sub-queries and quoted names now return correct column names +in projection (gh-7063). diff --git a/test/sql-luatest/gh_7063_dequote_test.lua b/test/sql-luatest/gh_7063_dequote_test.lua index 90843e9f9a..70f51530ad 100644 --- a/test/sql-luatest/gh_7063_dequote_test.lua +++ b/test/sql-luatest/gh_7063_dequote_test.lua @@ -1,6 +1,5 @@ local server = require('luatest.server') local t = require('luatest') - local g = t.group() g.before_all(function() -- GitLab