Skip to content

Commit 0d0e784

Browse files
EliSauderCopilot
andcommitted
feat(postgresql): read COMMENT ON DOMAIN
COMMENT ON DOMAIN was skipped, so a plugin saw an empty comment on a domain the schema commented. Translate it as COMMENT ON TYPE, which already finds the domain by its type name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d7d59c3 commit 0d0e784

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎internal/endtoend/testdata/codegen_json_domains_postgresql/gen/codegen.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
]
162162
},
163163
"not_null": true,
164-
"comment": ""
164+
"comment": "A book's title"
165165
},
166166
{
167167
"name": "price",

‎internal/endtoend/testdata/codegen_json_domains_postgresql/postgresql/schema.sql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ CREATE TABLE books (
1111
price price,
1212
ref billing.ksuid
1313
);
14+
COMMENT ON DOMAIN title IS 'A book''s title';

‎internal/engine/postgresql/parse.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func translate(node *nodes.Node) (ast.Node, error) {
431431
Comment: makeString(n.Comment),
432432
}, nil
433433

434-
case nodes.ObjectType_OBJECT_TYPE:
434+
case nodes.ObjectType_OBJECT_TYPE, nodes.ObjectType_OBJECT_DOMAIN:
435435
rel, err := parseRelation(n.Object)
436436
if err != nil {
437437
return nil, err

0 commit comments

Comments
 (0)