Subject RE: [firebird-support] Access rights error when using UDF on a subselect.
Author Alan McDonald
> Hi All,
>
> We found a problem when using a UDF that receives the value of a
> subselect from a view. Firebird does parse the access right correctly
> and says that there is no permission for read/select on the
> underlaying table.
>
> Ex:
> /* Make sure there is a user "test" in firebird.*/
>
> create database "c:\test.fdb" user "sysdba" password "masterkey";
> create table test(test integer);
> create view test_view
> as
> select *
> from test;
> grant all on test to view test_view;
> grant all on test_view to public;
> commit;
> insert into test values (1);
> commit;
> select abs((select sum(test) from test_view)) from test_view;
> /*The select statement was succesfull*/
> commit;
> connect c:\test.fdb user "test" password "password";
> select * from test_view;
> DECLARE EXTERNAL FUNCTION ABS
> DOUBLE PRECISION
> RETURNS DOUBLE PRECISION BY VALUE
> ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';
> commit;
> select abs((select sum(test) from test_view)) from test_view;
> /*last statement raises an exception:
> Statement failed, SQLCODE = -551
>
> no permission for read/select access to COLUMN TEST*/
> quit;
>
> Does anyone know about this problem?
> The above script was written for isql.exe.
>
> WI-V6.3.4.4910 Firebird 1.5
> Windows XP SP2.
>
> Cheers,
> Calin.

What's the differences between
> select abs((select sum(test) from test_view)) from test_view;
and
> select abs(sum(test)) from test_view;

Alan