Jefffrey opened a new issue, #2421:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2421
We can use underscores in numbers, however if we have more than one in
succession `10__00` or trailing `10_00_` this should error according to
postgres:
```sql
postgres=# select version();
version
--------------------------------------------------------------------------------------------------------------------------
PostgreSQL 18.2 (Debian 18.2-1.pgdg13+1) on aarch64-unknown-linux-gnu,
compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
(1 row)
postgres=# select 10__00;
ERROR: trailing junk after numeric literal at or near "10__00"
LINE 1: select 10__00;
^
postgres=# select 10_00_;
ERROR: trailing junk after numeric literal at or near "10_00_"
LINE 1: select 10_00_;
^
postgres=# select 10_00;
?column?
----------
1000
(1 row)
```
This seems to currently be accepted:
```rust
// tests/sqlparser_postgres.rs
#[test]
fn parse_incorrect_underscores() {
let sql = "SELECT 10_00";
let result = pg().parse_sql_statements(sql);
assert!(result.is_err());
let sql = "SELECT 10_00_";
let result = pg().parse_sql_statements(sql);
assert!(result.is_err());
}
```
- test fails since both of the statements parse successfully
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]