Subject Re: [ib-support] Metadata update statement is not allowed....
Author Claudio Valderrama C.
"Helen Borrie" <helebor@...> wrote in message
news:4.2.0.58.20010904185037.016eacc0@......
> At 10:46 AM 04-09-01 +0200, you wrote:
> >Hi,
> >
> >I have a Query that workes fine with Dialect 1 but if I switch do
> >dialect 3 I get the following error message:
> >
> >Metadata update statement is not allowed by the current database SQL
> >dialect 3
> >
> >Is there somethin I can do about it?

I think I know the original question, since I asked Rainer to post there.
:-)

The problem is the db dialect v/s the client dialect.
BDE is a client dialect 1. (I don't know about the last patch to BDE, that
according to David Robinson, can cause headaches.)
If the db is dialect 1 and all the tables were created with dialect 1, all
is fine. However, like anything in life, there are quirks:

IF THE DB IS DIALECT 3 AND THE CLIENT IS DIALECT 1 AND ONE OPERATION TRIES
TO CONVERT SOMETHING TO
NUMERIC(P,S) WITH P > 9, SINCE DIALECT 1 CAN'T USE EXACT NUMERICS AND THE DB
IS DIALECT 3 (SO IT WILL USE EXACT NUMERICS FOR P GREATER THAN 9), THERE'S
AN OBVIOUS CONFLICT AND YOU GET THAT ERROR MESSAGE.

Why am I shouting? Because I expect this error to appear from time to time
thanks to dialect mismatches and the people that Borland hired for support
(in replacement of the gone knowledgeable chaps we knew) are unlikely to
recognize immediately this mostly undocumented (albeit expected) behavior.
So I had hopes that shouting a bit will help people (users, tool devs) to
memorize an error that -I accept- is really confusing and time-consuming if
you don't suspect what's happening under the hood.

This is an example using isql where fbtest.gdb is a dialect 3 db and isql
will be forced to behave as a dialect 1 client:

Use CONNECT or CREATE DATABASE to specify a database
SQL> connect c:/proy/fbtest.gdb;
Database: c:/proy/fbtest.gdb
SQL> set sql dialect 1;
WARNING: Client SQL dialect has been set to 1 when connecting to Database
SQL dialect 3 database.
SQL> select cast(1as numeric(10,0)) from rdb$database;
Statement failed, SQLCODE = -817

Dynamic SQL Error
-SQL error code = -817
-Metadata update statement is not allowed by the current database SQL
dialect 3
SQL>

[Warning: don't put the Firebird near dry wood or cotton, it may be
dangerous.]

C. (I still don't care about shareholders. <g>)
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing