Subject Re: VIEW + UDF = CRASH
Author Riaan Nagel
Hi,

Does this look like a bug? If so, what is the proper procedure for
reporting it?

I've also found another bug-lookalike: just run the following SQL
statement on the same database and watch FireBird server (1.0.3) die
horribly.

select * from test_view t1
inner join test_view_2 t2 on t1.id = t2.id
inner join test_table t3 on t2.id = t3.id

On another (production) database I'm working on the join of two
views and a table causes this error:

" The cursor identified in the update or delete statement is not
positioned on a row.
no current record for fetch operation."

Thanks,
Riaan

--- In firebird-support@yahoogroups.com, "Riaan Nagel" <riaann@k...>
wrote:
> Hi,
>
> The second of the two following SQL statements (which make use of
> the ib_udf function "ceiling") crashes the FireBird server (found
on
> both FB 1.0.3.972 and FB 1.5 RC 3.) The error reported in the
> FireBird log is "... terminated abnormally (-1)" for FB 1.0.3,
> whereas FB1.5 has 4294967295 as the error number (which is,
> obviously, the same bit pattern interpreted as an unsigned 32 bit
> integer). The only difference between "test_view"
and "test_view_2"
> is that "test_view" represents a UNION of four SELECT statements,
> whereas "test_view_2" adds an additional UNION, making it five
> SELECT statements in the UNION.
>
> /* fine */
> select ceiling((select max(id) from test_view)) from rdb$database
>
> /* fails with server terminating abnormally (4294967295) */
> select ceiling((select max(id) from test_view_2)) from rdb$database
>
> The DDL script for an example database:
>
> SET SQL DIALECT 3;
>
> SET NAMES NONE;
>
> CREATE DATABASE 'c:\working\example.fdb'
> USER 'SYSDBA' PASSWORD 'masterkey'
> PAGE_SIZE 4096
> DEFAULT CHARACTER SET NONE;
>
> DECLARE EXTERNAL FUNCTION CEILING
> DOUBLE PRECISION
> RETURNS DOUBLE PRECISION BY VALUE
> ENTRY_POINT 'IB_UDF_ceiling' MODULE_NAME 'ib_udf';
>
> CREATE TABLE TEST_TABLE (
> ID INTEGER
> );
>
> CREATE VIEW TEST_VIEW(
> ID)
> AS
> select ID from test_table
> union select ID from test_table
> union select ID from test_table
> union select ID from test_table;
>
>
> CREATE VIEW TEST_VIEW_2(
> ID)
> AS
> select ID from test_table
> union select ID from test_table
> union select ID from test_table
> union select ID from test_table
> union select ID from test_table;
>
> /************** END OF SCRIPT ******************/
>
>
> Best Regards,
> Riaan