[ https://issues.apache.org/jira/browse/FLINK-24050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17406632#comment-17406632 ]
Jark Wu commented on FLINK-24050: --------------------------------- Sounds good to me. From my perspective, metadata columns are also some-kind physical column. > Support primary keys on metadata columns > ---------------------------------------- > > Key: FLINK-24050 > URL: https://issues.apache.org/jira/browse/FLINK-24050 > Project: Flink > Issue Type: Improvement > Components: Table SQL / API > Reporter: Ingo Bürk > Priority: Major > > Currently, primary keys are required to consist solely of physical columns. > However, there might be scenarios where the actual payload/records do not > contain a suitable primary key, but a unique identifier is available through > metadata. In this case it would make sense to define the primary key on such > a metadata column: > {code:java} > CREATE TABLE T ( > uid METADATA, > content STRING > PRIMARY KEY (uid) NOT ENFORCED > ) WITH (…) > {code} > A simple example for this would be IMAP: there is nothing unique about any > single email as a record, but each email in a specific folder on an IMAP > server has a unique UID (I'm excluding some irrelevant technical details > here). -- This message was sent by Atlassian Jira (v8.3.4#803005)