Issue Details (XML | Word | Printable)

Key: CORE-2130
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Kuznetsov Eugene
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Client could crash if DDL and DML are executed in the same transaction

Created: 18/Oct/08 06:09 AM   Updated: 21/Dec/14 07:40 PM
Component/s: API / Client Library, Engine
Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1
Fix Version/s: None


 Description  « Hide
Testing for 2.5, but other versions are also undergone.

isql failed (AV in fbclient.dll) when trying executing select statement, as no fields
exist at that moment. Server should return an error, but doesn't do it.

SET AUTODDL OFF;
SET SQL DIALECT 3;
SET NAMES WIN1251;

CONNECT test25 USER 'SYSDBA' PASSWORD 'masterkey';

CREATE TABLE NEW_TABLE7 (ID SMALLINT NOT NULL);
COMMIT;

insert into NEW_TABLE7(ID) VALUES (0);
COMMIT;

ALTER TABLE NEW_TABLE7
ADD FIELD1 CHAR(1) NOT NULL;

ALTER TABLE NEW_TABLE7
DROP ID;

select * from New_table7;

COMMIT;

--
Best regards, Eugene


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 19/Oct/08 10:16 AM
Actually, this ticket is not about metadata handling but about API usage. This test case forces the prepare/describe call to clear the sqld value of XSQLDA and pass it to the fetch call. It works okay for the embedded engine but fails for other connection types in the remote protocol code. This situation could be easily reproduced at the API level with any valid select statement.

So, this issue leaves us with a question: should we allow to fetch records with empty output XSQLDA (sqld == 0) or not? The engine itself is ready for that. Also, some clever person could use this trick to check for EOF (or count rows) without retrieving the values of the select list. Therefore, I tend to fix the code to allow such queries. From another side, this "feature" doesn't make any sense for 99% of the users...

Opinions?

Kuznetsov Eugene added a comment - 19/Oct/08 12:04 PM
To Dmitry Yemanov

> Opinions?
Though dataset without columns sounds strange for me, it can make sense for optimization goals.
Maybe, we should hear developers dealing with API - Dmitry Kovalenko or Dimitry Sibiryakov, for example.
--
Best regards, Eugene

Alexander Peshkov added a comment - 27/Oct/08 08:52 AM
As a minimum requirement AV should be fixed. But IMHO it's better to let remote select 0 columns in SQLDA - if it does not require rewriting half of remote's code.