apache / apache/datafusion-sqlparser-rs

Support `WITH ORDINALITY` in PostgreSQL parsing

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

Description

`WITH ORDINALITY` can be used as a suffix for any [set returning function](https://www.postgresql.org/docs/devel/functions-srf.html) in a `FROM` clause to append a new column containing the row's ordinal position. Simple example:

```sql
SELECT * FROM unnest(ARRAY['a', 'b', 'c']) WITH ORDINALITY;
unnest | ordinality
--------+------------
a | 1
b | 2
c | 3
(3 rows)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the PostgreSQL parser path for set-returning functions in a FROM clause and inspect nearby syntax coverage. Use the issue's unnest example as the parsing case, then verify that the WITH ORDINALITY suffix is accepted and represented correctly by the parser.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, rust, sql
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.