You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jeremy Osterhoudt (Jira)" <ji...@apache.org> on 2025/10/16 00:09:00 UTC

[jira] [Comment Edited] (CALCITE-6654) Postgres NUMERIC type leads to "DECIMAL precision 0 must be between 1 and 19"

    [ https://issues.apache.org/jira/browse/CALCITE-6654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030194#comment-18030194 ] 

Jeremy Osterhoudt edited comment on CALCITE-6654 at 10/16/25 12:08 AM:
-----------------------------------------------------------------------

Starting in 1.39 this exception breaks the JDBC adapter functionality for Postgres, SQL Server and Oracle (maybe others).  Postgres, Oracle and SQL Server will all report precision as null/0 if a DECIMAL is defined without explicit precision (Allowed in all 3 products).  The JdbcSchema schema class's getRelDataType creates a type factory temporarily, fetches the precision from JDBC and then calls createSqlType which will throw if the JDBC driver reports null/0 precision (which is now a side affect for the temporary factory for JDBC).

 

For JDBC it might make the most sense to catch this exception and default to 1 and/or allow a property/factory to be set to handle these conditions.  I'm happy to address this issue, but want to get opinions on how to handle this issue.

 

CC: [~julianhyde] [~mbudiu] 


was (Author: JIRAUSER311237):
Starting in 1.39 this exceptions breaks the JDBC adapter functionality for Postgres, SQL Server and Oracle (maybe others).  Postgres, Oracle and SQL Server will all report precision as null/0 if a DECIMAL is defined without explicit precision (Allowed in all 3 products).  The JdbcSchema schema class's getRelDataType creates a type factory temporarily, fetches the precision from JDBC and then calls createSqlType which will throw if the JDBC driver reports null/0 precision (which is now a side affect for the temporary factory for JDBC).

 

For JDBC it might make the most sense to catch this exception and default to 1 and/or allow a property/factory to be set to handle these conditions.  I'm happy to address this issue, but want to get opinions on how to handle this issue.

 

CC: [~julianhyde] [~mbudiu] 

> Postgres NUMERIC type leads to "DECIMAL precision 0 must be between 1 and 19"
> -----------------------------------------------------------------------------
>
>                 Key: CALCITE-6654
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6654
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: Ulrich Kramer
>            Priority: Major
>
> Tying to query a VIEW in Postgres, which has one column of type NUMERIC, leads to the error
> {noformat}
> DECIMAL precision 0 must be between 1 and 19 {noformat}
> The corresponding precision metadata column in postgres contains a NULL value.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)