[ https://issues.apache.org/jira/browse/FLINK-36861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dawid Wysakowicz closed FLINK-36861. ------------------------------------ Fix Version/s: 2.0.0 Resolution: Fixed Fixed in master: 5ca9eef5250c257d466d98dd13a8d0dc14fe8ab4 > CREATE TABLE AS with METADATA columns doesn't work > -------------------------------------------------- > > Key: FLINK-36861 > URL: https://issues.apache.org/jira/browse/FLINK-36861 > Project: Flink > Issue Type: Bug > Reporter: Sergio Peña > Assignee: Sergio Peña > Priority: Major > Labels: pull-request-available > Fix For: 2.0.0 > > > When creating a table with CTAS with a metadata column in the CREATE part, if > the source query already declares that, then the CTAS fails that it cannot > override the metadata column: > > {{CREATE TABLE payments (}} > {{ payment_id STRING PRIMARY KEY NOT ENFORCED,}} > {{ payment_time TIMESTAMP(3) METADATA FROM 'timestamp'}} > {{) DISTRIBUTED BY HASH(payment_id) INTO 4 BUCKETS}} > {{WITH ('connector' = 'kafka')}} > {{AS SELECT payment_id, payment_time FROM source;}} > > The error is: > {{A column named 'payment_time' already exists in the source schema. Computed > and metadata columns cannot overwrite regular columns.}} > > We should allow CTAS to write source columns to metadata columns (if metadata > cols are not virtual). Only computed and virtual metadata columns should be > read-only and not allowed in the query-to-sink. -- This message was sent by Atlassian Jira (v8.20.10#820010)