Watch, Follow, &
Connect with Us
Public Report
Report From: InterBase/Server    [ Add a report in this area ]  
Report #:  110482   Status: Closed
Server terminated abnormally when new field is computed by with case
Project:  InterBase Build #:  WI-V10.0.4.590
Version:    10.0 Submitted By:   Karol Bieniaszewski
Report Type:  Crash / Data loss / Total failure Date Reported:  11/15/2012 2:03:24 AM
Severity:    Critical / Show Stopper Last Updated: 4/26/2013 8:59:49 PM
Platform:    Windows 95/98/NT 4.0 on Intel Internal Tracking #:  
Resolution: Fixed (Resolution Comments) Resolved in Build: : 11.0.2.540
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
Server terminated abnormally when new field is computed by with case
try steeps to reproduce

in interbase log we get

PC-641 (Client)
Thu Nov 15 10:51:22 2012

REMOTE INTERFACE/gds__detach: Unsuccessful detach from database.

Uncommitted work may have been lost

PC-641 (Server)
Thu Nov 15 10:55:50 2012

process_packet() servicing opcode=68
   Access violation.


The code attempted to access a virtual


address without privilege to do so.

This exception will cause the InterBase server

to terminate abnormally.

PC-641 (Client)
Thu Nov 15 10:55:50 2012

C:\Embarcadero\InterBase\bin\ibserver.exe: terminated abnormally (-1)


PC-641 (Server)
Thu Nov 15 10:55:51 2012

Server: version 10.0.4.590 (32-bit), ibconfig settings...
        SWEEP_QUANTUM to 250, USER_QUANTUM to 1000,
        SWEEP_YIELD_TIME to 1 ms, and MAX_THREADS to 1000000
        SQL_COMPILER_RECURSION to 2000


PC-641 (Client)
Thu Nov 15 10:55:51 2012

Guardian starting: C:\Embarcadero\InterBase\bin\ibserver.exe
Steps to Reproduce:
1.
--------------------------------
CREATE TABLE "TEST"
(
  ZLEC_FAKT_NR
INTEGER
);

commit;
--------------------------------

2.
--------------------------------
insert into TEST(ZLEC_FAKT_NR) VALUES(1);
insert into TEST(ZLEC_FAKT_NR) VALUES(-1);

commit;
--------------------------------

3.
--------------------------------
DECLARE EXTERNAL FUNCTION SUBSTR
CSTRING(80) CHARACTER SET WIN1250, SMALLINT, SMALLINT
RETURNS CSTRING(80) CHARACTER SET WIN1250 FREE_IT
ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf.dll';


DECLARE EXTERNAL FUNCTION STRLEN
CSTRING(32767) CHARACTER SET WIN1250
RETURNS INTEGER BY VALUE
ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';

commit;
--------------------------------

4. try select - this work ok
--------------------------------
select
cast(
CASE WHEN ZLEC_FAKT_NR<0 THEN '-' ELSE '' END ||
substr(
   '00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN -ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)),
   strlen('00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)))-4,
   strlen('00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN -ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)))) as varchar(5))
FROM TEST
--------------------------------

5. try add computed by field on the same formula
--------------------------------
ALTER TABLE TEST
ADD CZLEC_FAKT_NR_NR2
COMPUTED BY (
cast(
CASE WHEN ZLEC_FAKT_NR<0 THEN '-' ELSE '' END ||
substr(
   '00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN -ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)),
   strlen('00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)))-4,
   strlen('00000' || cast(CASE WHEN ZLEC_FAKT_NR<0 THEN -ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR END as varchar(5)))) as varchar(5))
   )
--------------------------------

server terminated abnormally....
Workarounds
None
Attachment
None
Comments

Sriram Balasubramanian at 1/2/2013 2:03:14 PM -
Logged in internal bug reporting system as JIRA case INTB-1719

Karol Bieniaszewski at 2/5/2013 6:32:03 AM -
I found that only this syntax crash server

CASE WHEN ..

but this work

CASE XXX WHEN ..

Karol Bieniaszewski at 1/2/2013 11:55:52 PM -
I see that this is for every computed by field with "case"
My sample can be simplified to e.g.

COMPUTED BY(CASE WHEN ZLEC_FAKT_NR>50 THEN ZLEC_FAKT_NR ELSE ZLEC_FAKT_NR + 200 END)

server crash

Server Response from: ETNACODE01