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

Datatype declaration DECFLOAT without precision should use a default precision [CORE5710] #5976

Closed
firebird-issue-importer opened this issue Jan 15, 2018 · 9 comments

Comments

@firebird-issue-importer

Submitted by: @mrotteveel

SQL:2016 specifies the following for datatype declaration of DECFLOAT:

"""
<decimal floating-point type> ::=
DECFLOAT [ <left paren> <precision> <right paren> ]
"""

In other words, specifying the precision is optional, as explicitly defined in the Syntax rules:

"""
20) If a <precision> is omitted, then an implementation-defined <precision> is implicit.
"""

I propose we default to precision 34 when no precision has been specified, choosing the higher precision.

Currently trying to create a column with just DECFLOAT yields:

Executing statement...
Error: *** IBPP::SQLException ***
Context: Statement::Execute( CREATE TABLE decfloat_no_precision
(
decfloat_np decfloat
) )
Message: isc_dsql_execute2 failed

SQL Message : -607
This operation is not defined for system tables.

Engine Code : 335544351
Engine Message :
unsuccessful metadata update
CREATE TABLE DECFLOAT_NO_PRECISION failed
SQL error code = -607
Invalid command
Specified domain or source column DECFLOAT does not exist

Commits: 4566623

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 15, 2018

Commented by: @aafemt

I would rather choose max precision (34).

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 21, 2018

Modified by: @mrotteveel

description: SQL:2016 specifies the following for datatype declaration of DECFLOAT:

"""
<decimal floating-point type> ::=
DECFLOAT [ <left paren> <precision> <right paren> ]
"""

In other words, specifying the precision is optional, as explicitly defined in the Syntax rules:

"""
20) If a <precision> is omitted, then an implementation-defined <precision> is implicit.
"""

I propose we default to precision 16 when no precision has been specified, choosing the lower precision, similar to what we currently do with FLOAT (where FLOAT without precision or precision less than 8 maps to REAL, and precision >= 8 to DOUBLE PRECISION).

Currently trying to create a column with just DECFLOAT yields:

Executing statement...
Error: *** IBPP::SQLException ***
Context: Statement::Execute( CREATE TABLE decfloat_no_precision
(
decfloat_np decfloat
) )
Message: isc_dsql_execute2 failed

SQL Message : -607
This operation is not defined for system tables.

Engine Code : 335544351
Engine Message :
unsuccessful metadata update
CREATE TABLE DECFLOAT_NO_PRECISION failed
SQL error code = -607
Invalid command
Specified domain or source column DECFLOAT does not exist

=>

SQL:2016 specifies the following for datatype declaration of DECFLOAT:

"""
<decimal floating-point type> ::=
DECFLOAT [ <left paren> <precision> <right paren> ]
"""

In other words, specifying the precision is optional, as explicitly defined in the Syntax rules:

"""
20) If a <precision> is omitted, then an implementation-defined <precision> is implicit.
"""

I propose we default to precision 34 when no precision has been specified, choosing the higher precision.

Currently trying to create a column with just DECFLOAT yields:

Executing statement...
Error: *** IBPP::SQLException ***
Context: Statement::Execute( CREATE TABLE decfloat_no_precision
(
decfloat_np decfloat
) )
Message: isc_dsql_execute2 failed

SQL Message : -607
This operation is not defined for system tables.

Engine Code : 335544351
Engine Message :
unsuccessful metadata update
CREATE TABLE DECFLOAT_NO_PRECISION failed
SQL error code = -607
Invalid command
Specified domain or source column DECFLOAT does not exist

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 21, 2018

Commented by: @mrotteveel

Good point, changed it to 34

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 2, 2018

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 24, 2018

Commented by: @mrotteveel

I'm preparing a pull request that fixes this.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 24, 2018

Commented by: @mrotteveel

Pull request: #150

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 26, 2018

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 29, 2018

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 29, 2018

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants