Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starting with doesn't work as expected [CORE290] #621

Closed
firebird-automations opened this issue Jul 31, 2002 · 12 comments
Closed

starting with doesn't work as expected [CORE290] #621

firebird-automations opened this issue Jul 31, 2002 · 12 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: aroman (aroman)

Attachments:
test.sql

SFID: 589052#⁠
Submitted By: aroman

"Starting with" doesn't work as expected if a value is
used at the left side and a field at right side, if an index
on that field is used by the plan. It does work with a
natural plan.

Env: Windows 2000, firebird 1.0 Windows superserver
build (also reproduced with interbase 6.02 Windows
superserver)

CREATE TABLE "Test"
(
"Test_Field" VARCHAR(30) NOT NULL,
CONSTRAINT "PK_Test" PRIMARY KEY ("Test_Field")
);

/* populate it with some values */
insert into"Test"("Test_Field") values ('4');
insert into"Test"("Test_Field") values ('41');
insert into"Test"("Test_Field") values ('411');

/* this one doesn't work as expected - it goes through
index */
select "Test_Field" from "Test" where '411.1' starting
with "Test_Field";

/* this one works well, but because of cast - rtrim can be
used instead - uses plan(natural) */
select "Test_Field" from "Test" where '411.1' starting
with CAST("Test_Field" As VARCHAR(30));

@firebird-automations
Copy link
Collaborator Author

Commented by: Alice F. Bird (firebirds)

Date: 2002-07-31 14:26
Sender: ded
Logged In: YES
user_id=188889

Sorry, I understand bug tracker is'nt place for
discussions, but, Helen, what docs do you use? I'm still
vegetating with IB6 OS one and

search condition ...
| <val> [NOT] STARTING [WITH] <val>
....

page 141 and

<val> = {
col [ <array_dim>] | : variable
| <constant> | <expr> | <function>
| udf ([ <val> [, <val> ???]])
| NULL | USER | RDB$DB_KEY | ?
} [COLLATE collation] [AS alias]

page 140. And if you want to treat as bug that engine
don't rejects

WHERE <constant or expression> STARTING WITH <COLUMN
IDENTIFIER>

wouldn't you be so kind to wait until FB will allow another
method to transfer set of parameters for IN substituon in
stored procedure? This is more related to CONTAINING, but...
Or do you want to doom us to mess around those nasty
"temporary" tables with garbage collection problems etc?

Best regards, Alexander V.Nevsky.

@firebird-automations
Copy link
Collaborator Author

Commented by: Alice F. Bird (firebirds)

Date: 2002-07-31 13:49
Sender: helebor
Logged In: YES
user_id=60469

Of course it doesn't work as expected if you subvert the syntax of the language!

The syntax for the STARTING WITH is

WHERE <COLUMN IDENTIFIER> STARTING WITH <constant or expression>

Nowhere (in standards or in documentation) is it suggested that you can capsize this predicate and get the
expected result (have the optimizer consider an index on <COLUMN IDENTIFIER>).

If bug there be, it ought to be that the engine rejects a predicate of the form

WHERE <constant or expression> STARTING WITH <COLUMN IDENTIFIER>

That it fails to do so seems to be one more example of the sloppy parsing being done by DSQL.

-- Helen

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Closed [ 6 ] => Reopened [ 4 ]

assignee: Dmitry Yemanov [ dimitr ]

SF_ID: 589052 =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Reopened [ 4 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 1.5.0 [ 10025 ]

SF_ID: 589052 =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

SF_ID: 589052 =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Reopened just to add attachment.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Closed [ 6 ] => Reopened [ 4 ]

SF_ID: 589052 =>

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

script to reproduce the bug

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Attachment: test.sql [ 10092 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Reopened [ 4 ] => Closed [ 6 ]

resolution: Fixed [ 1 ]

SF_ID: 589052 =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10314 ] => Firebird [ 14527 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants