CREATE TABLE — define a new table
https://www.postgresql.org/docs/current/sql-createtable.html https://docs.snowflake.com/en/sql-reference/sql/create-table.html https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#creating_a_new_table https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
create table my_table ( ... ) breaks a lot of "rules" elsewhere in SQL... in particular, the space between the table name and the parens, and the really the use of parens at all, mean that create table is more like a word operator (or even a plain name) than a unterminated keyword. I need to think through how we want to lex this and how specific the formatting rules should be just for this one (very common) statement.
Hey @tconbeer, have you had time to think this through ? I took a look myself and I'm not sure how to implement it properly.
@pauldes Admittedly this is not my top priority right now. Looking back at this with fresh eyes, it would be relatively easy to auto-format to something like the following:
create table if not exists
foo
(
a int not null,
b varchar,
...
primary key a
)
partition by a
Which is pretty different from the styles I usually see, but which I don't hate, tbh. The "problem" is really the initial create table... keyword, and the fact that it works together with the parens of column defs, which makes its mechanics distinct from other keywords, like select