apache / apache/datafusion-sqlparser-rs

Improve postgres CREATE FUNCTION support

Open
#1,405 0 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

Hey,

I'm trying to parse `CREATE FUNCTION` statements (PostgreSQL) with the following attributes:

```sql
CREATE OR REPLACE FUNCTION public.accounting_ids()
RETURNS SETOF uuid
LANGUAGE plpgsql
STABLE SECURITY DEFINER
SET search_path TO ''
AS $function$
```

A few features fail to parse:
1. `SETOF [type]` is not supported (Expected: end of statement, found: uuid at Line: 5, Column: 16)
2. `SECURITY DEFINER` is not supported (Expected: end of statement, found: SECURITY at Line: 7, Column: 9)
3. `SET search_path TO ''` is not supported (Expected: end of statement, found: SET at Line: 7, Column: 2)

Using sqlparser 0.50.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the PostgreSQL CREATE FUNCTION example against sqlparser 0.50.0 and locate the parser entry point for CREATE FUNCTION. Trace how return types and function attributes are handled, then add coverage for SETOF uuid, SECURITY DEFINER, and SET search_path TO ''. Done means all three constructs parse successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, rust
Domain
databases
Issue type
Bug
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.