apache / apache/datafusion-sqlparser-rs

Duplicate column in CREATE TABLE statement

Open
#668 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

SQLite raises a parser error with the following DDL:
```sh
sqlite> CREATE TABLE test (
...> x TEXT,
...> x TEXT
...> );
Parse error: duplicate column name: x
```
But `sqlparser` doesn't:

```sh
% cargo run --example cli ddl.sql --sqlite
...
Round-trip:
'CREATE TABLE test (x TEXT, x TEXT)'
Parse results:
[
CreateTable {
...
```
Is this kind of checks considered out of scope ?
Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the discrepancy with the SQLite DDL and the `cargo run --example cli ddl.sql --sqlite` command. Start by tracing how the CREATE TABLE statement is parsed, then determine whether duplicate column names should be rejected. Done means the parser's behavior is decided and covered consistently for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.