fix failing plan_test, add more rewriting tests for database()

Signed-off-by: deepthi <deepthi@planetscale.com>
This commit is contained in:
deepthi 2020-02-05 17:16:47 -08:00
Родитель 3cb2f6c2e6
Коммит 6151d4ca38
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -44,6 +44,11 @@ func TestRewrites(in *testing.T) {
expected: "SELECT :__vtdbname as `database()`",
db: true, liid: false,
},
{
in: "SELECT database() from test",
expected: "SELECT database() from test",
db: false, liid: false,
},
{
in: "SELECT last_insert_id() as test",
expected: "SELECT :__lastInsertId as test",
@ -54,6 +59,16 @@ func TestRewrites(in *testing.T) {
expected: "SELECT :__lastInsertId + :__vtdbname as `last_insert_id() + database()`",
db: true, liid: true,
},
{
in: "select (select database()) from test",
expected: "select (select database() from dual) from test",
db: false, liid: false,
},
{
in: "select (select database() from dual) from test",
expected: "select (select database() from dual) from test",
db: false, liid: false,
},
{
in: "select (select database() from dual) from dual",
expected: "select (select :__vtdbname as `database()` from dual) as `(select database() from dual)` from dual",

Просмотреть файл

@ -1078,7 +1078,7 @@
"Name": "user",
"Sharded": true
},
"Query": "select id from user where :__vtdbname",
"Query": "select id from user where database()",
"FieldQuery": "select id from user where 1 != 1",
"Table": "user"
}