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

Some queries raises bugcheck 232 - EVL_expr: invalid operation [CORE2829] #1185

Closed
firebird-automations opened this issue Jan 27, 2010 · 11 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

Is duplicated by CORE2872

If some aggregate expression of a lower context is inside some expressions like IN, ANY, ALL, it's generated invalid BLR. Example:

select id from account where id in (select count(id) from rdb$database);

====== Test Details ======

See test for core-2872

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Could it be related to CORE1605?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

They seems related (in the sense of wrong BLR instead of proper error, and the bugcheck message). The cause should also be related, that seems missing nodes not being visited, but different ones.

So if you like to mark that as duplication, feel free. I current have no solution and real knowledge of what exactly is wrong.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Another type of query raising this error. When aggregate is used as the second argument of LIST:
select list(1, count(*)) from t;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Another problematic query (per CORE2872):
select 1 from rdb$database where count(*) >= all (select count(*) from rdb$database);

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue is duplicated by CORE2872 [ CORE2872 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Miroslav Djorov (miro)

Firebird version 2.1.3

I have two queries that use similar statements. In the first the statements are in SELECT section, in the second they are in the WHERE section:
SELECT
http://NAST.ID,
COALESCE(SUM(SMETKI_EL.SUMA *
(
SELECT FIRST 1
KURS_HISTORY.KURS
FROM
KURS_HISTORY
WHERE
KURS_HISTORY.VAL_ID = SMETKI_EL.VAL_ID
AND KURS_HISTORY.OPR_ID < SMETKI_EL.OPR_ID
ORDER BY KURS_HISTORY.ID DESC
)
),0.00) AS SUMA,
SUM(COALESCE(
(
SELECT
SUM(SMT_PAY_NODE.SUMA)
FROM
SMT_PAY_NODE
WHERE
SMT_PAY_NODE.SMETKA_EL_ID = SMETKI_EL.ID
)
,0.00)) AS SUMA_PAY
FROM
NAST LEFT JOIN SMETKI_EL ON SMETKI_EL.DEF_NAST_ID = http://NAST.ID
WHERE
NAST.NAST_ID = :TIT_ID
AND NAST.ROOM_ID = :ROOM_ID
GROUP BY 1

and

SELECT
SMETKI_EL.ID
FROM
SMETKI_EL
WHERE
SMETKI_EL.DEF_NAST_ID = :OLD_TIT_ID
AND (COALESCE(SMETKI_EL.SUMA *
(
SELECT FIRST 1
KURS_HISTORY.KURS
FROM
KURS_HISTORY
WHERE
KURS_HISTORY.VAL_ID = SMETKI_EL.VAL_ID
AND KURS_HISTORY.OPR_ID < SMETKI_EL.OPR_ID
ORDER BY KURS_HISTORY.ID DESC
)
,0.00) - SUM(COALESCE(
(
SELECT
SUM(SMT_PAY_NODE.SUMA)
FROM
SMT_PAY_NODE
WHERE
SMT_PAY_NODE.SMETKA_EL_ID = SMETKI_EL.ID
)
,0.00)) <> 0.00)
ORDER BY 1

After I've added the part with -SUM(...) in the second query the execution gives this error:
"Internal gds software consistency check (EVL_expr: invalid operation (232), file evl.cpp line: (1168)."
And after that the DB is corrupted.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

What exactly do you mean by "DB is corrupted"?

@firebird-automations
Copy link
Collaborator Author

Commented by: Miroslav Djorov (miro)

When I've wrote the last message, database validation showed errors in the database. But today I'm making more tests and I can't reproduce the corruption of the database.
On Friday consistency check (ca there were some test applications working with the database. All of them got "internal gds softwaren't continue after bugcheck)"
error when I executed the query above. And I had to kill all apps and I've restarted Firebird. Maybe the corruption of the database I saw, was a side effect of these actions.
I'm not sure. But today I can't reproduce the corruption of the database file. The only thing is that all connections to the database in the time when I execute
the query get "internal gds software consistency check (can't continue after bugcheck)"

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

After a bugcheck, any command raises bugchecks until you close a database, to prevent more problems.

*This* bugcheck do not corrupt the databases.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Open [ 1 ] => Open [ 1 ]

QA Status: Covered by another test(s)

Test Details: See test for core-2872

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