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-automations opened this issue Jan 15, 2018 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

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-automations
Copy link
Collaborator Author

Commented by: @aafemt

I would rather choose max precision (34).

@firebird-automations
Copy link
Collaborator Author

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-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Good point, changed it to 34

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

I'm preparing a pull request that fixes this.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Pull request: #150

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

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