You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "fmguerreiro (via GitHub)" <gi...@apache.org> on 2026/04/27 01:59:05 UTC

[PR] PostgreSQL: COMMENT ON CONSTRAINT / OPERATOR / RULE [datafusion-sqlparser-rs]

fmguerreiro opened a new pull request, #2324:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2324

   ## Summary
   
   Adds parser + AST coverage for the three remaining `COMMENT ON …` shapes that the fork had been silently rejecting:
   
   - `COMMENT ON CONSTRAINT name ON [DOMAIN] target IS '…'`
   - `COMMENT ON OPERATOR name (left, right) IS '…'` — each side may be `NONE` for unary operators
   - `COMMENT ON RULE name ON target IS '…'`
   
   ## Changes
   
   - `CommentObject` gains `Constraint`, `Operator`, `Rule` variants in `keyword_str` and `from_keyword`.
   - New `CommentOperatorArgs { left: Option<DataType>, right: Option<DataType> }` carries the operand signature for `OPERATOR`, with `Display` rendering `NONE` for unary slots.
   - `Statement::Comment` gains two fields: `operator_args: Option<CommentOperatorArgs>` and `on_domain: bool` (only meaningful for `Constraint`). Existing destructures will need to add the two fields.
   - `parse_comment` dispatches the new variants:
     - `OPERATOR` uses `parse_operator_name()` (so `+`, `myschema.@@`, etc. round-trip) and a mandatory `(slot, slot)` signature.
     - `CONSTRAINT` and `RULE` require an `ON <relation>` tail; `CONSTRAINT` additionally accepts `ON DOMAIN <domain>`.
   - Refactors `parse_drop_operator_signature` to share a new `parse_operator_arg_type_or_none()` helper with `parse_comment`.
   - Bumps fork to `0.63.0`; adds `changelog/0.63.0.md`.
   
   ## Breaking changes
   
   `Statement::Comment` adds `operator_args` and `on_domain` fields. Consumers that destructure all fields explicitly must add them; those using `..` rest patterns are unaffected. Documented in `changelog/0.63.0.md`.
   
   ## Test plan
   
   - [ ] `cargo test --package pgmold-sqlparser` (CI)
   - New tests in `tests/sqlparser_postgres.rs`:
     - [x] `parse_comment_on_constraint_on_table` (binary form + `IS NULL` + `IF EXISTS`)
     - [x] `parse_comment_on_constraint_on_domain` (unqualified + schema-qualified domain)
     - [x] `parse_comment_on_constraint_requires_relation_tail` (error case)
     - [x] `parse_comment_on_operator_binary` (`public.+(INTEGER, INTEGER)`)
     - [x] `parse_comment_on_operator_prefix_left_none` (unary prefix, `NONE` left)
     - [x] `parse_comment_on_operator_postfix_right_none` (unary postfix, `NONE` right)
     - [x] `parse_comment_on_operator_requires_argument_list` (error case)
     - [x] `parse_comment_on_rule` + `IS NULL`
     - [x] `parse_comment_on_rule_requires_relation_tail` (error case)
   - Updated all existing `Statement::Comment` destructures in `tests/sqlparser_postgres.rs` to include the two new fields.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: COMMENT ON CONSTRAINT / OPERATOR / RULE [datafusion-sqlparser-rs]

Posted by "fmguerreiro (via GitHub)" <gi...@apache.org>.
fmguerreiro commented on PR #2324:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2324#issuecomment-4323702460

   Created against the wrong remote — closing. This is fork-only work targeting fmguerreiro/datafusion-sqlparser-rs (the pgmold-sqlparser publishing fork).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] PostgreSQL: COMMENT ON CONSTRAINT / OPERATOR / RULE [datafusion-sqlparser-rs]

Posted by "fmguerreiro (via GitHub)" <gi...@apache.org>.
fmguerreiro closed pull request #2324: PostgreSQL: COMMENT ON CONSTRAINT / OPERATOR / RULE
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2324


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org