PostgreSqlDialect: `*=` and `@@@` are split into two tokens,
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Start by running the reproduction with PostgreSqlDialect and Parser::parse_sql on SELECT a *= b and SELECT a @@@ b, then find where the tokenizer groups operator characters into operator tokens. The issue lists the operators to support (*=, *<>, *<, *<=, *>, *>=, @@@) and the OPERATOR(pg_catalog.*=) form. Done means each statement parses as a single operator and to_string() round-trips without splitting.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
version 0.63.0, PostgreSqlDialect.
PostgreSQL's lexer reads a run of operator characters as one operator (manual, "Lexical Structure", "Operators"; src/backend/parser/scan.l). However, sqlparser only recognizes a specific list, so operators end up split.
The composite type comparison operators (manual, "Composite Type Comparison")::
SELECT a *= b -- Expected: an expression, found: =
SELECT a *<> b -- Expected: an expression, found: <>
SELECT a *< b -- Expected: an expression, found: <
SELECT a *<= b -- Expected: an expression, found: <=
SELECT a *> b -- Expected: an expression, found: >
SELECT a *>= b -- Expected: an expression, found: >=
The @@@ operator doesn't cause an error but is parsed incoretory.
SELECT a @@@ b -- parses as a @@ (@b); to_string() gives: SELECT a @@ @b
`SELECT 'a b'::tsvector @@@ 'a'::tsquery; -- t
SELECT 'a b'::tsvector @@ @ 'a'::tsquery; -- ERROR: operator does not exist
I ran into similar issues trying to write it as OPERATOR() which failed similiarly:
SELECT a OPERATOR(pg_catalog.*=) b -- Expected: ), found: =
SELECT a OPERATOR(pg_catalog.@@@) b -- Expected: ), found: @
The * operators are valid on PostgreSQL 18.6, on values of a record type:
SELECT a *= b, a = b, a *< b, a *<> b
FROM (SELECT ROW(1.0) a, ROW(1.00) b) s; -- f | t | f | t
How to reproduce:
use sqlparser::{dialect::PostgreSqlDialect, parser::Parser};
for sql in ["SELECT a *= b", "SELECT a @@@ b"] {
println!("{:?}", Parser::parse_sql(&PostgreSqlDialect {}, sql).map(|s| s
}
- Vorherrschende Sprache
- Rust
- Sterne
- 3.5k
- Forks
- 805
- Ø Merge
- 2 T. 3 Std.
- Gemergte PRs (30 T.)
- 116
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus apache/datafusion-sqlparser-rs
-
Redshift
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
apache/datafusion-sqlparser-rs#2959 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Redshift
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
apache/datafusion-sqlparser-rs#2958 ·
Maintainer antworten meist innerhalb von 1 Tag
-
PostgreSQL
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
apache/datafusion-sqlparser-rs#2862 ·
Maintainer antworten meist innerhalb von 1 Tag
-
PostgreSQL
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
apache/datafusion-sqlparser-rs#2861 ·
Maintainer antworten meist innerhalb von 1 Tag
-
PostgreSQL
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
apache/datafusion-sqlparser-rs#2858 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in apache/datafusion-sqlparser-rs
Ähnliche Issues
-
P3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
HerringtonDarkholme/hd-lang#1770 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
jonathanong/no-mistakes#3332 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
swc-project/swc-next-issues#310 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
swc-project/swc-ai-issues#653 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
lbjlaq/Antigravity-Manager#3937 ·
Maintainer antworten meist innerhalb von 1 Tag