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

COMPUTED-BY expressions are not converted to their field type inside the engine [CORE5097] #5382

Closed
firebird-issue-importer opened this issue Feb 2, 2016 · 4 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Feb 2, 2016

Submitted by: @pavel-zotov

COMPUTED BY field's type are currently used only for describe the value.

Samples from CORE5092 (new ticket was created as Adriano suggested):

Sample-1.

SQL> recreate table test(
CON> t0 timestamp default 'now'
CON> ,t1 timestamp computed by( 'now' ) ---------------- ::: NB ::: 't1' has EXPLICITLY defined type: TIMESTAMP
CON> ,t2 computed by( extract(day from t1) ) ------------ Should TIMESTAMP type of 't1' be seen from here ?
CON> );
SQL> insert into test default values;
SQL> set list on;
SQL> select t0, t1 from test;

T0 2016-02-01 16:21:00.2210
T1 2016-02-01 16:21:00.2210

SQL> select t0, t1, t2 from test;

Statement failed, SQLSTATE = 42000
expression evaluation not supported
-Invalid argument for EXTRACT() not being of DATE/TIME/TIMESTAMP type
SQL>

Sample-2

create table t1 (n1 integer, c1 integer computed by (1.2));
insert into t1 values (0);
commit;

select * from t1;

      N1 C1

============ ============
0 1

select c1 || '' from t1;

CONCATENATION

1.2

Commits: b1efab5 04f5f59 1b3d63e 798a4a5 51d57b0 FirebirdSQL/fbt-repository@9847778 FirebirdSQL/fbt-repository@53be350 FirebirdSQL/fbt-repository@43becf3 FirebirdSQL/fbt-repository@b69a5e6 FirebirdSQL/fbt-repository@077e8af

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 2, 2016

Modified by: @asfernandes

description: Samples from CORE5092 (new ticket was created as Adriano suggested):

Sample-1.

SQL> recreate table test(
CON> t0 timestamp default 'now'
CON> ,t1 timestamp computed by( 'now' ) ---------------- ::: NB ::: 't1' has EXPLICITLY defined type: TIMESTAMP
CON> ,t2 computed by( extract(day from t1) ) ------------ Should TIMESTAMP type of 't1' be seen from here ?
CON> );
SQL> insert into test default values;
SQL> set list on;
SQL> select t0, t1 from test;

T0 2016-02-01 16:21:00.2210
T1 2016-02-01 16:21:00.2210

SQL> select t0, t1, t2 from test;

Statement failed, SQLSTATE = 42000
expression evaluation not supported
-Invalid argument for EXTRACT() not being of DATE/TIME/TIMESTAMP type
SQL>

Sample-2

create table t1 (n1 integer, c1 integer computed by (1.2));
insert into t1 values (0);
commit;

select * from t1;

      N1 C1

============ ============
0 1

select c1 || '' from t1;

CONCATENATION

1.2

=>

COMPUTED BY field's type are currently used only for describe the value.

Samples from CORE5092 (new ticket was created as Adriano suggested):

Sample-1.

SQL> recreate table test(
CON> t0 timestamp default 'now'
CON> ,t1 timestamp computed by( 'now' ) ---------------- ::: NB ::: 't1' has EXPLICITLY defined type: TIMESTAMP
CON> ,t2 computed by( extract(day from t1) ) ------------ Should TIMESTAMP type of 't1' be seen from here ?
CON> );
SQL> insert into test default values;
SQL> set list on;
SQL> select t0, t1 from test;

T0 2016-02-01 16:21:00.2210
T1 2016-02-01 16:21:00.2210

SQL> select t0, t1, t2 from test;

Statement failed, SQLSTATE = 42000
expression evaluation not supported
-Invalid argument for EXTRACT() not being of DATE/TIME/TIMESTAMP type
SQL>

Sample-2

create table t1 (n1 integer, c1 integer computed by (1.2));
insert into t1 values (0);
commit;

select * from t1;

      N1 C1

============ ============
0 1

select c1 || '' from t1;

CONCATENATION

1.2

summary: Unexpected affect of COMPUTED-BY value on results in some cases => COMPUTED-BY expressions are not converted to their field type inside the engine

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 3, 2016

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 RC2 [ 10048 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 4, 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 Feb 4, 2016

Modified by: @pavel-zotov

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

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

No branches or pull requests

2 participants