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:
@@ -1,4 +1,4 @@
|
||||
//! Matrix coverage for `create table T with pk [<col>:<type>[, ...]]`
|
||||
//! Matrix coverage for `create table T with pk [<col>(<type>)[, ...]]`
|
||||
//! (ADR-0005, ADR-0009).
|
||||
|
||||
use crate::typing_surface::*;
|
||||
@@ -73,7 +73,7 @@ fn after_pk_word_does_not_re_offer_pk() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn after_pk_space_with_col_name_typed_expects_colon() {
|
||||
fn after_pk_space_with_col_name_typed_expects_paren() {
|
||||
let schema = schema_empty();
|
||||
let a = assess_at_end("create table Customers with pk Code", &schema);
|
||||
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
||||
@@ -81,10 +81,10 @@ fn after_pk_space_with_col_name_typed_expects_colon() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn after_colon_expects_type_candidates() {
|
||||
fn after_paren_expects_type_candidates() {
|
||||
let schema = schema_empty();
|
||||
let a = assess_at_end(
|
||||
"create table Customers with pk Code:",
|
||||
"create table Customers with pk Code(",
|
||||
&schema,
|
||||
);
|
||||
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
||||
@@ -92,14 +92,14 @@ fn after_colon_expects_type_candidates() {
|
||||
&a,
|
||||
&["text", "int", "serial", "shortid", "bool"],
|
||||
);
|
||||
crate::snap!("after_colon", a);
|
||||
crate::snap!("after_paren", a);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_table_with_explicit_pk_parses() {
|
||||
let schema = schema_empty();
|
||||
let a = assess_at_end(
|
||||
"create table Customers with pk Code:text",
|
||||
"create table Customers with pk Code(text)",
|
||||
&schema,
|
||||
);
|
||||
assert!(matches!(a.state, InputState::Valid));
|
||||
@@ -110,7 +110,7 @@ fn create_table_with_explicit_pk_parses() {
|
||||
fn create_table_with_compound_pk_parses() {
|
||||
let schema = schema_empty();
|
||||
let a = assess_at_end(
|
||||
"create table Memberships with pk UserId:int, GroupId:int",
|
||||
"create table Memberships with pk UserId(int), GroupId(int)",
|
||||
&schema,
|
||||
);
|
||||
assert!(matches!(a.state, InputState::Valid));
|
||||
|
||||
Reference in New Issue
Block a user