Skip to content

Commit 2b98344

Browse files
committed
readyset-sql: Change ordering of options in conversion
There is literally no good reason for this to be one order versus the other, it just matches existing tests this way. If we cared about preserving the input ordering, at some point we could upstream a fix to sqlparser-rs which treats table options as a Vec (like column options) instead of individual fields. But I think we only care about matching the input for proxied queries where users may be trying to find a specific query; DDL we don't generally show back to the user, and we only care about some options and not their order. Change-Id: Ic0130359d97255303d1d5d293806d2aec7a8b7c9
1 parent ddacd26 commit 2b98344

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

readyset-sql/src/ast/create.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ impl TryFromDialect<sqlparser::ast::CreateTable> for CreateTableStatement {
179179
dialect: Dialect,
180180
) -> Result<Self, AstConversionError> {
181181
// XXX: We don't actually care about most table options, and don't cover the DATA DIRECTORY
182-
// variant because sqlparser doesn't support it.
182+
// variant because sqlparser doesn't support it. Note that this is likely change the
183+
// ordering of the options compared to the original SQL, since sqlparser stores them as
184+
// individual fields instead of a list of options.
183185
let mut options = vec![];
184-
if let Some(auto_increment) = value.auto_increment_offset {
185-
options.push(CreateTableOption::AutoIncrement(auto_increment as u64));
186-
}
187186
if let Some(engine) = value.engine {
188187
options.push(CreateTableOption::Engine(Some(engine.name)));
189188
}
189+
if let Some(auto_increment) = value.auto_increment_offset {
190+
options.push(CreateTableOption::AutoIncrement(auto_increment as u64));
191+
}
190192
if let Some(charset) = value.default_charset {
191193
options.push(CreateTableOption::Charset(CharsetName::Unquoted(
192194
charset.into(),

0 commit comments

Comments
 (0)