docs: ColumnOption::ForeignKey docs have wrong SQL syntax
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 72/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- documentation
Research direction
Open the linked docs.rs page and locate the ColumnOption::ForeignKey documentation in the repository source. Verify the column-constraint syntax against the examples in the issue, then correct the syntax description and place the large syntax literal in its own paragraph. Done means the generated documentation describes valid column syntax without the table-constraint FOREIGN KEY prefix.
Written by the indexing model from the issue text.
Description
https://docs.rs/sqlparser/0.55.0/sqlparser/ast/enum.ColumnOption.html#variant.ForeignKey
says
A referential integrity constraint (
[FOREIGN KEY REFERENCES <foreign_table> (<referred_columns>) { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] } [<constraint_characteristics>]).
I believe the FOREIGN KEY (name) REFERENCES syntax is only for table constraints. That's why it has to say which source columns it talks about!
I believe the syntax for column constraints is just col_name REFERENCES othertable (othercolumn).
As far as I can tell, the sqlparser-rs is already correct. For example, this won't parse:
-- wrong
CREATE TABLE myschema.mytable (
mycolumn BIGINT NOT NULL,
PRIMARY KEY(mycolumn),
bar BIGINT FOREIGN KEY REFERENCES foo (bar));
This does:
-- good
CREATE TABLE myschema.mytable (
mycolumn BIGINT NOT NULL,
PRIMARY KEY(mycolumn),
bar BIGINT REFERENCES foo (bar));
While we're at it, that big syntax literal should live in its own paragraph.
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 774
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 15
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/datafusion-sqlparser-rs
-
Difficulty 2/5 1-2 days Newbie friendliness 72/100
apache/datafusion-sqlparser-rs#2495 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/datafusion-sqlparser-rs#2461 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
apache/datafusion-sqlparser-rs#2407 ·
-
Add SQL/PGQ keywords Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/datafusion-sqlparser-rs#2393 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
apache/datafusion-sqlparser-rs#2390 · 1 comment ·
All issues in apache/datafusion-sqlparser-rs
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·