Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-30386

Column constraint lacks primary key not enforced check

    XMLWordPrintableJSON

Details

    Description

      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.

      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
      

      Attachments

        Issue Links

          Activity

            People

              qingyue Jane Chan
              qingyue Jane Chan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: