2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
|
|
|
ID: issue-5406
|
|
|
|
ISSUE: 5406
|
|
|
|
TITLE: Expression index may not be used by the optimizer if created and used in different connection charsets
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5122
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5122
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
db = db_factory()
|
2021-11-29 20:54:28 +01:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
PLAN (TEST INDEX (TEST_CALC_S))
|
2021-11-29 20:54:28 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
with act.db.connect(charset='iso8859_1') as con1:
|
2021-11-29 20:54:28 +01:00
|
|
|
cur1 = con1.cursor()
|
|
|
|
cur1.execute("recreate table test(s varchar(10))")
|
|
|
|
cur1.execute("create index test_calc_s on test computed by ('zxc' || s)")
|
|
|
|
con1.commit()
|
|
|
|
#
|
2022-01-25 22:55:48 +01:00
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.isql(switches=['-n'],
|
2021-11-29 20:54:28 +01:00
|
|
|
input="set planonly; select * from test where 'zxc' || s starting with 'qwe';")
|
2022-01-25 22:55:48 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|