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

lincoln lee updated FLINK-30386:
--------------------------------
    Fix Version/s: 1.17.0

> Column constraint lacks primary key not enforced check
> ------------------------------------------------------
>
>                 Key: FLINK-30386
>                 URL: https://issues.apache.org/jira/browse/FLINK-30386
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.16.0, 1.15.2, 1.15.3
>            Reporter: Jane Chan
>            Assignee: Jane Chan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.17.0
>
>
> Currently, only table constraint performs the enforced check. Not sure if it 
> is by design or a bug.
> The following case can be reproduced on Flink 1.16.0, 1.15.3, and 1.15.2. I 
> think the earlier version might also reveal it.
> {code:sql}
> Flink SQL> create table T (f0 int not null primary key, f1 string) with 
> ('connector' = 'datagen');
> [INFO] Execute statement succeed.
> Flink SQL> explain select * from T;
> == Abstract Syntax Tree ==
> LogicalProject(f0=[$0], f1=[$1])
> +- LogicalTableScan(table=[[default_catalog, default_database, T]])
> == Optimized Physical Plan ==
> TableSourceScan(table=[[default_catalog, default_database, T]], fields=[f0, 
> f1])
> == Optimized Execution Plan ==
> TableSourceScan(table=[[default_catalog, default_database, T]], fields=[f0, 
> f1])
> Flink SQL> create table S (f0 int not null, f1 string, primary key(f0)) with 
> ('connector' = 'datagen');
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.table.api.ValidationException: Flink doesn't support 
> ENFORCED mode for PRIMARY KEY constraint. ENFORCED/NOT ENFORCED  controls if 
> the constraint checks are performed on the incoming/outgoing data. Flink does 
> not own the data therefore the only supported mode is the NOT ENFORCED mode
> {code}



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

Reply via email to