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

context already in use (BLR error) for query used with and subqueries [CORE5759] #6022

Open
firebird-automations opened this issue Feb 22, 2018 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Artem Anufriev (atronah)

I get error:
{code}
invalid request BLR at offset 204
context already in use (BLR error)
GDSCODE = 335544343
SQLCODE = -104
{code}

when try to execute this query:
{code:sql}
with info as (
select
iif(1 in (select 1 as x from rdb$database), 1, 0) as flag
from rdb$database
)
select
iif(info.flag > 0, 1, 1) as a,
iif(info.flag > 0, 1, 1) as b,
0 as c
from info
{code}

This query works fine
- on Firebird 2.5.
- if you comment line with param `a` or param `b` (only one of them).

@firebird-automations
Copy link
Collaborator Author

Commented by: Artem Anufriev (atronah)

reformats code blocks

@firebird-automations
Copy link
Collaborator Author

Modified by: Artem Anufriev (atronah)

description: I get error:
```
invalid request BLR at offset 204
context already in use (BLR error)
GDSCODE = 335544343
SQLCODE = -104
```

when try to execute this query:
```
with info as (
select
iif(1 in (select 1 as x from rdb$database), 1, 0) as flag
from rdb$database
)
select
iif(info.flag > 0, 1, 1) as a,
iif(info.flag > 0, 1, 1) as b,
0 as c
from info
```

This query works fine
- on Firebird 2.5.
- if you comment line with param `a` or param `b` (only one of them).

=>

I get error:
{code}
invalid request BLR at offset 204
context already in use (BLR error)
GDSCODE = 335544343
SQLCODE = -104
{code}

when try to execute this query:
{code:sql}
with info as (
select
iif(1 in (select 1 as x from rdb$database), 1, 0) as flag
from rdb$database
)
select
iif(info.flag > 0, 1, 1) as a,
iif(info.flag > 0, 1, 1) as b,
0 as c
from info
{code}

This query works fine
- on Firebird 2.5.
- if you comment line with param `a` or param `b` (only one of them).

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

You realize that you have the same expression for both a and b?

What happens if you change iif(info.flag > 0, 1, 1) as b to iif(info.flag < 0, 1, 1) as b ?

@firebird-automations
Copy link
Collaborator Author

Commented by: Artem Anufriev (atronah)

> You realize that you have the same expression for both a and b?

Strange question. Of course I realize that. And I realise, that this error occurs only when both of a and b are used (or, to be specific, that second use the `flag` is cause of error).

> What happens if you change iif(info.flag > 0, 1, 1) as b to iif(info.flag < 0, 1, 1) as b ?
Nothing changes.
Indeed, if you left only `flag` without `iif()` statement, error will occur.

I tested this query:

with info as (
select
iif(1 in (select 1 as x from rdb$database), 1, 0) as flag
from rdb$database
)
select
info.flag as a,
info.flag as b,
0 as c
from info

and get the same error

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

1 participant