2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
|
|
|
ID: issue-529
|
|
|
|
ISSUE: 529
|
|
|
|
TITLE: ORDER BY works wrong with collate PT_PT
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-202
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_202
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
init_script = """CREATE TABLE STOCKS (
|
2021-04-26 20:07:00 +02:00
|
|
|
MNEN INTEGER NOT NULL,
|
|
|
|
ACTIVO VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE PT_PT
|
|
|
|
);
|
|
|
|
|
|
|
|
COMMIT WORK;
|
|
|
|
|
|
|
|
INSERT INTO STOCKS (MNEN, ACTIVO) VALUES (1, 'B&A');
|
|
|
|
INSERT INTO STOCKS (MNEN, ACTIVO) VALUES (2, 'BES');
|
|
|
|
INSERT INTO STOCKS (MNEN, ACTIVO) VALUES (3, 'BCP');
|
|
|
|
INSERT INTO STOCKS (MNEN, ACTIVO) VALUES (4, 'B&A Pref.');
|
|
|
|
INSERT INTO STOCKS (MNEN, ACTIVO) VALUES (5, 'Banif');
|
|
|
|
|
|
|
|
COMMIT WORK;
|
|
|
|
|
|
|
|
CREATE COLLATION PT_PT2 FOR ISO8859_1 FROM PT_PT 'SPECIALS-FIRST=1';
|
|
|
|
|
|
|
|
COMMIT WORK;
|
|
|
|
|
|
|
|
CREATE TABLE STOCKS2 (
|
|
|
|
MNEN INTEGER NOT NULL,
|
|
|
|
ACTIVO VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE PT_PT2
|
|
|
|
);
|
|
|
|
|
|
|
|
COMMIT WORK;
|
|
|
|
|
|
|
|
INSERT INTO STOCKS2 (MNEN, ACTIVO) VALUES (1, 'B&A');
|
|
|
|
INSERT INTO STOCKS2 (MNEN, ACTIVO) VALUES (2, 'BES');
|
|
|
|
INSERT INTO STOCKS2 (MNEN, ACTIVO) VALUES (3, 'BCP');
|
|
|
|
INSERT INTO STOCKS2 (MNEN, ACTIVO) VALUES (4, 'B&A Pref.');
|
|
|
|
INSERT INTO STOCKS2 (MNEN, ACTIVO) VALUES (5, 'Banif');
|
|
|
|
|
|
|
|
COMMIT WORK;
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
test_script = """SELECT ACTIVO FROM STOCKS ORDER BY ACTIVO;
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
SELECT ACTIVO FROM STOCKS2 ORDER BY ACTIVO;
|
|
|
|
"""
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
expected_stdout = """ACTIVO
|
2021-04-26 20:07:00 +02:00
|
|
|
==================================================
|
|
|
|
B&A
|
|
|
|
Banif
|
|
|
|
B&A Pref.
|
|
|
|
BCP
|
|
|
|
BES
|
|
|
|
|
|
|
|
ACTIVO
|
|
|
|
==================================================
|
|
|
|
B&A
|
|
|
|
B&A Pref.
|
|
|
|
Banif
|
|
|
|
BCP
|
|
|
|
BES
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|