[ 
https://issues.apache.org/jira/browse/NIFI-14929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

RAVINARAYAN SINGH updated NIFI-14929:
-------------------------------------
        Fix Version/s: 2.6.0
    Affects Version/s: 2.4.0
          Description: 
 
NiFi Version: 2.4.0
Postgres: 14
I am encountering an issue when using {{*DatabaseTableSchemaRegistry*}} with 
the following table definition:
 
{code:java}
CREATE TABLE stage.status_monitor (
        filename varchar NULL,
        dataset varchar NULL,
        table_name varchar NULL,
        data_format varchar NULL,
        created_at timestamptz NULL DEFAULT CURRENT_TIMESTAMP 
); {code}

But i am getting following error :
 
{code:java}
org.apache.nifi.schema.access.SchemaNotFoundException: Could not retrieve 
schema with name 'status_monitor' from the configured Schema Registry - Caused 
by: java.lang.IllegalArgumentException: Cannot set the default value for field 
[created_at] to [CURRENT_TIMESTAMP] because that is not a valid value for Data 
Type [TIMESTAMP:yyyy-MM-dd HH:mm:ss] {code}

>From reviewing the code, it appears that NiFi expects a literal value rather 
>than a function for default values. Handling expressions would likely be 
>complex.

[Slack discussion 
|https://apachenifi.slack.com/archives/C0L9S92JY/p1755195086867549]

  was:
When inserting data into a database, NiFi does not need to provide values for 
columns with default constraints. The database automatically applies those 
defaults at insert time.

[Slack discussion 
|https://apachenifi.slack.com/archives/C0L9S92JY/p1755195086867549]


> Add property to control use of database default constraints during inserts.
> ---------------------------------------------------------------------------
>
>                 Key: NIFI-14929
>                 URL: https://issues.apache.org/jira/browse/NIFI-14929
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 2.4.0
>            Reporter: RAVINARAYAN SINGH
>            Assignee: RAVINARAYAN SINGH
>            Priority: Minor
>              Labels: controller_services
>             Fix For: 2.6.0
>
>
>  
> NiFi Version: 2.4.0
> Postgres: 14
> I am encountering an issue when using {{*DatabaseTableSchemaRegistry*}} with 
> the following table definition:
>  
> {code:java}
> CREATE TABLE stage.status_monitor (
>       filename varchar NULL,
>       dataset varchar NULL,
>       table_name varchar NULL,
>       data_format varchar NULL,
>       created_at timestamptz NULL DEFAULT CURRENT_TIMESTAMP 
> ); {code}
> But i am getting following error :
>  
> {code:java}
> org.apache.nifi.schema.access.SchemaNotFoundException: Could not retrieve 
> schema with name 'status_monitor' from the configured Schema Registry - 
> Caused by: java.lang.IllegalArgumentException: Cannot set the default value 
> for field [created_at] to [CURRENT_TIMESTAMP] because that is not a valid 
> value for Data Type [TIMESTAMP:yyyy-MM-dd HH:mm:ss] {code}
> From reviewing the code, it appears that NiFi expects a literal value rather 
> than a function for default values. Handling expressions would likely be 
> complex.
> [Slack discussion 
> |https://apachenifi.slack.com/archives/C0L9S92JY/p1755195086867549]



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

Reply via email to