Repository navigation
feat: support column comments through driver capabilities - #187
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (8 files)
Reviewed by claude-sonnet-5.5 · Input: 244 · Output: 1.5K · Cached: 156.5K |
Version suggestionBased on this PR's title (
This is informational only — no tag or release is created automatically yet. |
aesslinger
left a comment
There was a problem hiding this comment.
Approving — this is a clean, faithful parity port of the built-in driver's column_comments capability. I diffed comment_sql, the add-column filter, and the alter-column comparison/ordering against the built-in implementation in the companion host PR (tabularis#1453), and they match byte-for-byte. E-string escaping, identifier quoting, the #[path] module layout, the #[serde(default)] comment field, and the filter(!is_empty()) guard are all consistent with the parity target. Test coverage is solid: quoting/SQL-builder unit tests plus a real-PostgreSQL stdio round-trip for add/update/remove with metadata preservation.
Potential follow-up (non-blocking, out of scope for this PR): the old_column.comment.as_deref().unwrap_or("") != new_column.comment.as_deref().unwrap_or("") comparison treats Some("") and None as identical, so a column with a stored empty-string comment (COMMENT ON COLUMN t.c IS '', set by another tool or hand SQL) cannot be cleared through the alter dialog — Some("").unwrap_or("") == None.unwrap_or("") produces no COMMENT IS NULL, and the empty-string comment persists.
This is a shared limitation, not a regression this PR introduces: the built-in driver uses the exact same unwrap_or("") comparison and filter(!is_empty()) guard, so fixing it here alone would create the parity drift the repo rules exist to prevent. If we want to clear empty-string comments, the fix should ship in both repos simultaneously and likely treats Some("") as "clear" (emit IS NULL) distinct from None (no comment). Worth tracking as a known parity gap for a future ticket.
Enables the shared
column_commentscapability for the external PostgreSQL driver, matching the built-in implementation in TabularisDB/tabularis#1453.Add Column appends
COMMENT ON COLUMN; Modify Column adds, replaces or clears a comment without restating unchanged attributes. Rename plus comment targets the new name. Escape strings preserve apostrophes, backslashes, Unicode and line breaks, with byte-identical output to the built-in driver. The optional field preserves older host payloads.Validation:
live_dbsuite for add/update/remove and metadata preservation. It compiles locally; execution awaits CI's PostgreSQL service.cargo fmt --all -- --checkpassed.bind_instead_of_mapwarning inmodels.rs:663allowed at the command line. The strict command hits that warning; no source suppression was added.Companion to host issue TabularisDB/tabularis#1448. No new RPC/capability name or version bump.