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

NULLIF crashes when first parameter is constant empty string [CORE1560] #1979

Closed
firebird-automations opened this issue Nov 2, 2007 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Vladimir Kozlov (vkozlov)

Is related to QA199

NULLIF crashes when first parameter is constant empty string and second parameter is constant or variable with empty string.

for example:

declare variable i varchar(10);
declare variable j varchar(10);

i = ''; j = nullif(i,i); - works

i = 'aaa'; j = nullif('',i); - works

i = ''; j = nullif('',i); - server crashes

Easiest way to reproduce:

select nullif('','') from rdb$database

Commits: 82d480d

@firebird-automations
Copy link
Collaborator Author

Commented by: Vladimir Kozlov (vkozlov)

2.1.0.16967 affected too.

@firebird-automations
Copy link
Collaborator Author

Modified by: Vladimir Kozlov (vkozlov)

description: Server crashes when inserting in GTT.

To reproduce, make a GTT on empty database:

create global temporary table doc$70$invoice (
iddocrow varchar(40) not null,
idgoods integer not null,
qty integer not null,
price double precision not null,
invamt double precision not null,
custcode varchar(40),
custproc double precision,
custposhl double precision,
custacciz double precision,
custtva double precision,
inv_plus_cust double precision,
udeln_summ_rash double precision,
inv_plus_cust_plus_rash double precision,
rezerv2182 integer,
recompriceopt double precision,
recompriceprim double precision,
newsprice double precision
) on commit delete rows;

alter table doc$70$invoice add constraint pk_doc$70$invoice primary key (iddocrow);

and try to execute insert (from IBExpert's SQL Editor)

INSERT INTO doc$70$invoice (iddocrow,idgoods,qty,price,invamt,custcode,recompriceopt,recompriceprim)
VALUES ( 'a975ce58-c1cf-11db-8000-e503b22223f1' , 136171 , 1056 , 67 , 1056 * 67 ,
'1' ,NULLIF( '' ,''), NULLIF( '' ,''))

After this server crashes.

=>

NULLIF crashes when first parameter is constant empty string and second parameter is constant or variable with empty string.

for example:

declare variable i varchar(10);
declare variable j varchar(10);

i = ''; j = nullif(i,i); - works

i = 'aaa'; j = nullif('',i); - works

i = ''; j = nullif('',i); - server crashes

Easiest way to reproduce:

select nullif('','') from rdb$database

summary: Server crashes when insert to GTT => NULLIF crashes when first parameter is constant empty string

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Cast from NULL to string value of 0 length was broken. Looks like it happened only with nullif('','').

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ]

Fix Version: 2.1 RC1 [ 10201 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA199 [ QA199 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 13373 ] => Firebird [ 14025 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pmakowski

Q/A test ok

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Done successfully

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