Subject Re: [firebird-support] Re: Potential computed by and UDF issue
Author Helen Borrie
At 02:03 PM 8/02/2005 +0000, you wrote:


>Does anyone care to take this question on please? Is there somewhere
>else I should report potential bugs?
> The error message (from IBExpert) is:
> >
> > IBE: Starting restore. Current time: 8:11:37 AM
> > gbak: opened file C:\dbdev\UDFComputedBy.FBK
> > gbak: transportable backup -- data in XDR format
> > gbak: backup file is compressed
> > IBE: Unsuccessful execution caused by system error that does not
> > preclude successful execution of subsequent statements.
> > action cancelled by trigger (0) to preserve data integrity.
> > could not find table/procedure for GRANT.

This message is telling you that a permission has been created for a table
that doesn't exist. Either you added a permission for a non-existent table
name (perhaps omitting quotes from a table identifier that needed them? or
vice versa?).

If you didn't add that permission, then for some reason, the restore didn't
restore your table. However, the restore should have fallen over when
*that* failed.

> >
> > Here is the DDL for a simple test case.
> >
> >
>/******************************************************************************/
> > /**** Generated by IBExpert 2004.10.30 2/7/2005 8:19:45 AM
> > ****/
> >
>/******************************************************************************/
> >
> > SET SQL DIALECT 3;
> >
> > DECLARE EXTERNAL FUNCTION SUBSTR
> > CSTRING(80),
> > SMALLINT,
> > SMALLINT
> > RETURNS CSTRING(80) FREE_IT
> > ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf';
> >
> > CREATE TABLE NEW_TABLE (
> > NEW_FIELD VARCHAR(20),
> > CALCFIELD COMPUTED BY
> > (substr(new_field,1,1)||substr(new_field,2,1)));
> >
> > Is this a bug or am I doing something wrong?

Can't tell, as you don't show the offending GRANT statement. This DDL
backs up and restores fine in v.1.5.2.

Look up rdb$user_privileges and check what's in there as permissions on
that table.

BTW, the COMPUTED BY expression is invalid - the second substring could not
possibly return a result because you are asking for the substring that
starts at position 2 and ends at position 1 in the string. However, the
engine seems happy with it and just returns the first substring in the
expression.

./heLen