Skip to content

Fixed create table as with columns without types for redshift#2279

Open
romanoff wants to merge 1 commit intoapache:mainfrom
romanoff:fixed_ctas_without_column_types_for_redshift
Open

Fixed create table as with columns without types for redshift#2279
romanoff wants to merge 1 commit intoapache:mainfrom
romanoff:fixed_ctas_without_column_types_for_redshift

Conversation

@romanoff
Copy link
Contributor

Example query:

CREATE TEMP TABLE volt_tt_64c26ae9dfd43(userid, days_played_in_last_31) as select 1,2;

Spec: https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_AS.html

Comment on lines +511 to +512
"CREATE TEMP TABLE volt_tt(userid, days_played_in_last_31) AS SELECT 1, 2",
"CREATE TEMPORARY TABLE volt_tt (userid, days_played_in_last_31) AS SELECT 1, 2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test/PR isn't related to temporary tables? if so it would probably be better to remove the temp qualifiers and we can use verified_stmt as usual?

// CREATE TABLE t (col1, col2) AS SELECT 1, 2
// Detect this by peeking for `( ident ,` or `( ident )` patterns.
let (columns, constraints) =
if dialect_of!(self is RedshiftSqlDialect) && self.peek_column_names_only() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we convert this into a dialect method?

Actually looking at the code this feature seems to be solving a similar problem to is_column_type_sqlite_unspecified - likely we can instead have that parse_column_def function optionally accept a datatype if this method is true (and can rename the method accordingly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants