2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
|
|
|
ID: issue-2732
|
|
|
|
ISSUE: 2732
|
|
|
|
TITLE: SIMILAR TO produces random results with [x-y] expressions
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-2308
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_2308
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
init_script = """set term ^ ;
|
2021-04-26 20:07:00 +02:00
|
|
|
CREATE OR ALTER PROCEDURE PROC
|
|
|
|
RETURNS ( V INTEGER)
|
|
|
|
AS
|
|
|
|
BEGIN
|
|
|
|
IF ('b' SIMILAR TO ('[a-z]'))
|
|
|
|
THEN v = 1;
|
|
|
|
ELSE v = 2;
|
|
|
|
SUSPEND;
|
|
|
|
END ^
|
|
|
|
"""
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
test_script = """set term ^ ;
|
2021-04-26 20:07:00 +02:00
|
|
|
EXECUTE BLOCK AS
|
|
|
|
DECLARE I INT = 1000;
|
|
|
|
DECLARE V INT;
|
|
|
|
BEGIN
|
|
|
|
WHILE (I > 0) DO
|
|
|
|
BEGIN
|
|
|
|
I = I - 1;
|
|
|
|
SELECT V FROM PROC INTO :V;
|
|
|
|
|
|
|
|
IF (V <> 1)
|
|
|
|
THEN V = 1/0;
|
|
|
|
END
|
|
|
|
END ^
|
|
|
|
"""
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
2022-01-25 22:55:48 +01:00
|
|
|
act.execute()
|