[tarantool-patches] Re: [PATCH 1/2] sql: fix collation node duplication in AST
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sun May 12 19:32:49 MSK 2019
Hi! Thanks for the patch! Looks like the problem in the patch
is much easier to reproduce, without 'EXCEPT':
box.execute('SELECT s COLLATE "unicode_ci" FROM a ORDER BY 1 COLLATE "unicode_ci"')
Just use ORDER BY <number> + COLLATE.
But having got this simpler test I found that you broke another one.
Look at this schema:
box.cfg{}
box.execute('CREATE TABLE a (id INT PRIMARY KEY, s TEXT)')
box.execute("INSERT INTO a VALUES (1, 'B'), (2, 'b')")
Before your patch:
tarantool> box.execute('SELECT s COLLATE "unicode_ci" FROM a ORDER BY 1 COLLATE "unicode"')
---
- metadata:
- name: s COLLATE "unicode_ci"
type: string
rows:
- ['b']
- ['B']
...
After your patch:
tarantool> box.execute('SELECT s COLLATE "unicode_ci" FROM a ORDER BY 1 COLLATE "unicode"')
---
- metadata:
- name: s COLLATE "unicode_ci"
type: string
rows:
- ['B']
- ['b']
...
Result set order has changed. This is because you ignore a new collation
regardless of a name of a previous one. It means, that the patch should not
be applied as is.
We should either
1) Replace the old collation with a new one, as an optimization;
2) Left as is now.
I vote for the second as the simplest, and add a test provided by me
above to ensure we will never break it accidentally.
This commit should consist of the test and a comment in resolveAlias.
And keep this nice ASCII schema.
More information about the Tarantool-patches
mailing list