Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid computed by definition generated by isql -x [CORE5194] #5475

Closed
firebird-issue-importer opened this issue Apr 11, 2016 · 8 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @WarmBooter

This came from Alexandre B. Smith... isql -x from FB 3 RC2 is generated invalid sql script when computed by fields exists. The test works fine in FB 2.5:

create database "c:\sp\test.fdb";

CREATE TABLE T (A TIMESTAMP,
B COMPUTED BY (current_timestamp - a));

commit;

exit;

isql -user sysdba -password masterkey test.fdb -x > test.sql

The result is:
---------------------
SET SQL DIALECT 3;

CREATE DATABASE 'test.fdb' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE;

COMMIT WORK;

/* Table: T, Owner: SYSDBA */
CREATE TABLE T (A TIMESTAMP,
B NUMERIC(0, 9) COMPUTED BY (NULL));

/* Computed fields */

ALTER TABLE T
ALTER B TYPE NUMERIC(0, 9) COMPUTED BY (current_timestamp - a);

---------------------

Note the type of Column B defined as *NUMERIC(0,9)*

if you run it on isql you will get:
---------------------
Use CONNECT or CREATE DATABASE to specify a database
SQL> CREATE DATABASE 'test2.fdb' PAGE_SIZE 8192 DEFAULT CHARACTER SET NONE;
SQL>
SQL>
SQL> COMMIT WORK;
SQL>
SQL> /* Table: T, Owner: SYSDBA */
SQL> CREATE TABLE T (A TIMESTAMP,
CON> B NUMERIC(0, 9) COMPUTED BY (NULL));
Statement failed, SQLSTATE = HY104
Dynamic SQL Error
-SQL error code = -842
-Precision must be from 1 to 18
SQL>
SQL> /* Computed fields */
SQL>
SQL> ALTER TABLE T
CON> ALTER B TYPE NUMERIC(0, 9) COMPUTED BY (current_timestamp - a);
Statement failed, SQLSTATE = HY104
Dynamic SQL Error
-SQL error code = -842
-Precision must be from 1 to 18
SQL>

Commits: c20d83a 1767a51 53de05b 72ff004 ee2456d

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 11, 2016

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Modified by: @asfernandes

Version: 4.0 Initial [ 10621 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Commented by: @WarmBooter

Would it be possible to fix it in FB 3.0 too? I wonder how many people uses isql to generate DB metadata script and will have problems with all calculated fields declarations being invalid.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Commented by: @dyemanov

If Adriano will backport it tonight, it could be included. But it's unlikely to be documented, too late.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 12, 2016

Modified by: @asfernandes

Fix Version: 3.0.0 [ 10740 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment