DESC fields, keys and explicit indexes
Field-only formatting is M1; M2 key/index issues must extend this same formatter. Constraint-name output is optional in the course checker.
Contract
| Field | Value |
|---|---|
| Specification | TABLE-003 |
| Module | sql |
| Scope | Required implementation or delivery |
| Milestone | M1, due 2026-12-06 |
| Owner role | SQL / frontend — teammate to claim |
| Implementation | Planned; scaffold only |
| Contract review | Team review required before implementation |
Interface
Catalog.describe(table) -> SchemaDescription
These are proposed C++ design contracts, not an already implemented API. Shared types and ownership define the intended module boundaries.
Dependencies
Acceptance checklist
- [ ] Emit Field,Type,Null,Default in exact order
- [ ] Separate field rows from key/index lines by a blank line
- [ ] Print PRIMARY, FOREIGN, optional UNIQUE, then explicit INDEX lines with semicolons; omit implicit indexes
Setup data
Run this in a fresh isolated data directory before the example. Setup commands emit their own results; the expected block below covers only the listed input.
CREATE DATABASE demo;
USE demo;
CREATE TABLE people (id INT NOT NULL, name VARCHAR(16) NOT NULL, score FLOAT NOT NULL);
INSERT INTO people VALUES (1, 'Ada', 90.5), (2, 'Lin', 80.0);
Input
DESC people;
Expected output
Field,Type,Null,Default
id,INT,NO,NULL
name,VARCHAR(16),NO,NULL
score,FLOAT,NO,NULL
@
Where no ORDER BY appears, row order is not guaranteed. Error message text is illustrative; required diagnostic keywords and result framing are binding.
Rejections and state
- Unknown table -> !ERROR
Verification
Completion rule
Link this spec and its GitLab issue in an MR into develop. Include relevant Linux evidence, obtain the other teammate’s review, merge, delete the feature branch, and close the issue. A page describes intended behavior; the GitLab issue and merged code determine completion.