apache / apache/datafusion-sqlparser-rs
docs: ColumnOption::ForeignKey docs have wrong SQL syntax
- Vorherrschende Sprache
- Rust
- Sterne
- 3.5k
- Forks
- 772
- Ø Merge
- 4 T. 9 Std.
- Gemergte PRs (30 T.)
- 17
Beschreibung
https://docs.rs/sqlparser/0.55.0/sqlparser/ast/enum.ColumnOption.html#variant.ForeignKey
says
> A referential integrity constraint (`[FOREIGN KEY REFERENCES () { [ON DELETE ] [ON UPDATE ] | [ON UPDATE ] [ON DELETE ] } []`).
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:
```sql
-- wrong
CREATE TABLE myschema.mytable (
mycolumn BIGINT NOT NULL,
PRIMARY KEY(mycolumn),
bar BIGINT FOREIGN KEY REFERENCES foo (bar));
```
This does:
```sql
-- 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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Öffne die verlinkte docs.rs-Seite und finde die Dokumentation zu ColumnOption::ForeignKey im Repository-Quelltext. Überprüfe die Syntax für Spalten-Constraints anhand der Beispiele im Issue, korrigiere anschließend die Syntaxbeschreibung und platziere das große Syntaxliteral in einem eigenen Absatz. Die Aufgabe ist erledigt, wenn die generierte Dokumentation eine gültige Spaltensyntax ohne das Präfix FOREIGN KEY für Tabellen-Constraints beschreibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 72/100