You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When unloading metadata isql -x , calculated fields must be moved to the end of the list. Example:
Wrong:
CREATE TABLE OPERATIONS (
ID_OPERATION INTEGER NOT NULL ,
NAME_OPERATION VARCHAR(40) NOT NULL ,
DOCTYPE INTEGER,
DOCKIND COMPUTED BY (decode(doctype, -1, 1 - opertype, doctype)),
OPERTYPE INTEGER NOT NULL ,
OPERKIND INTEGER NOT NULL
);
After execution:
Dynamic SQL Error.
SQL error code = -206.
Column unknown.
OPERTYPE.
At line 5, column 61.
correctly:
CREATE TABLE OPERATIONS (
ID_OPERATION INTEGER NOT NULL ,
NAME_OPERATION VARCHAR(40) NOT NULL ,
DOCTYPE INTEGER,
OPERTYPE INTEGER NOT NULL ,
OPERKIND INTEGER NOT NULL ,
DOCKIND COMPUTED BY (decode(doctype, -1, 1 - opertype, doctype))
);
The text was updated successfully, but these errors were encountered:
I think it is only logical for the fields which a COMPUTED column should be defined before they can be referenced. As such, IMO this is not a bug (certainly not a "Major" one)
This can be reproduced only in 2.5; in 3.0 it was *for sure* fixed.
Script:
shell del c:\\temp\\c6149\.fdb 2\>nul;
create database 'localhost:c:\\temp\\c6149\.fdb' user 'SYSDBA' password 'masterkey';
set echo on;
set bail on;
create table test\(
id\_operation integer not null ,
name\_operation varchar\(40\) not null ,
doctype integer,
opertype integer not null ,
operkind integer not null ,
dockind computed by \(decode\(doctype, \-1, 1 \- opertype, doctype\)\)
\);
commit;
alter table test
alter column DOCKIND position 4
;
commit;
show table test;
=======
If we run there %FB25_HOME%\bin\isql -x <this_database>, then it will generate invalid medatata (checked on WI-V2.5.9.27144).
But this is not about 3.x which produces correct script:
SET SQL DIALECT 3;
. . .
CREATE TABLE TEST (ID_OPERATION INTEGER NOT NULL,
NAME_OPERATION VARCHAR(40) NOT NULL,
DOCTYPE INTEGER,
DOCKIND BIGINT COMPUTED BY (NULL),
OPERTYPE INTEGER NOT NULL,
OPERKIND INTEGER NOT NULL);
/* Computed fields */
ALTER TABLE TEST
ALTER DOCKIND TYPE BIGINT COMPUTED BY (decode(doctype, -1, 1 - opertype, doctype));
So, the only issue than can be seen here: 3.0 does not change computed field position to original (4).
Submitted by: Valchenko Igor (gallemar)
When unloading metadata isql -x , calculated fields must be moved to the end of the list. Example:
Wrong:
CREATE TABLE OPERATIONS (
ID_OPERATION INTEGER NOT NULL ,
NAME_OPERATION VARCHAR(40) NOT NULL ,
DOCTYPE INTEGER,
DOCKIND COMPUTED BY (decode(doctype, -1, 1 - opertype, doctype)),
OPERTYPE INTEGER NOT NULL ,
OPERKIND INTEGER NOT NULL
);
After execution:
Dynamic SQL Error.
SQL error code = -206.
Column unknown.
OPERTYPE.
At line 5, column 61.
correctly:
CREATE TABLE OPERATIONS (
ID_OPERATION INTEGER NOT NULL ,
NAME_OPERATION VARCHAR(40) NOT NULL ,
DOCTYPE INTEGER,
OPERTYPE INTEGER NOT NULL ,
OPERKIND INTEGER NOT NULL ,
DOCKIND COMPUTED BY (decode(doctype, -1, 1 - opertype, doctype))
);
The text was updated successfully, but these errors were encountered: