Grammar: with-pk column specs use name(type), matching add column
`create table … with pk` parsed column types as `name:type`,
while `add column` uses `name(type)`. Unify on the parens
form so column-type syntax is consistent across the DSL:
create table T with pk id(serial), name(text)
Only `COL_SPEC` changes (`:` → `( … )`); `build_create_table`
reads columns by role, so it is unaffected. The `:` that
separates table from column in `add column` / `drop column`
is unchanged. Sweeps the test suite, the typing-surface
matrix (two `after_colon` cells renamed to `after_paren`,
4 snapshots regenerated), the friendly catalog's usage
templates, ADR-0009's example, and requirements.md.
1039 passing / 0 failing / 1 ignored; clippy clean.
This commit is contained in:
@@ -1076,7 +1076,7 @@ mod tests {
|
||||
#[test]
|
||||
fn walker_parses_create_table_named_typed_pk() {
|
||||
assert_eq!(
|
||||
parse("create table Customers with pk email:text").unwrap(),
|
||||
parse("create table Customers with pk email(text)").unwrap(),
|
||||
Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![col("email", Type::Text)],
|
||||
@@ -1088,7 +1088,7 @@ mod tests {
|
||||
#[test]
|
||||
fn walker_parses_create_table_compound_pk() {
|
||||
assert_eq!(
|
||||
parse("create table OrderLines with pk order_id:int,product_id:int").unwrap(),
|
||||
parse("create table OrderLines with pk order_id(int),product_id(int)").unwrap(),
|
||||
Command::CreateTable {
|
||||
name: "OrderLines".to_string(),
|
||||
columns: vec![col("order_id", Type::Int), col("product_id", Type::Int)],
|
||||
@@ -1100,7 +1100,7 @@ mod tests {
|
||||
#[test]
|
||||
fn walker_create_table_pk_tolerates_whitespace_around_punct() {
|
||||
assert_eq!(
|
||||
parse("create table T with pk id : serial").unwrap(),
|
||||
parse("create table T with pk id ( serial )").unwrap(),
|
||||
Command::CreateTable {
|
||||
name: "T".to_string(),
|
||||
columns: vec![col("id", Type::Serial)],
|
||||
@@ -1108,7 +1108,7 @@ mod tests {
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
parse("create table T with pk a : int , b : int").unwrap(),
|
||||
parse("create table T with pk a ( int ) , b ( int )").unwrap(),
|
||||
Command::CreateTable {
|
||||
name: "T".to_string(),
|
||||
columns: vec![col("a", Type::Int), col("b", Type::Int)],
|
||||
@@ -1134,7 +1134,7 @@ mod tests {
|
||||
#[test]
|
||||
fn walker_create_table_keywords_are_case_insensitive() {
|
||||
assert_eq!(
|
||||
parse("CREATE TABLE Customers WITH PK email:TEXT").unwrap(),
|
||||
parse("CREATE TABLE Customers WITH PK email(TEXT)").unwrap(),
|
||||
Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![col("email", Type::Text)],
|
||||
|
||||
Reference in New Issue
Block a user