apache / apache/datafusion-sqlparser-rs

Support `CREATE TYPE` for creating custom type

Open
#535 5 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

Hello, I think it would be nice to add `CREATE TYPE` statement for creating custom composite type.

### Use cases
```sql
-- Defining composite type
CREATE TYPE inventory_item AS (
name text,
supplier_id integer,
price numeric
);

-- Using composite type `inventory_item`
CREATE TABLE on_hand (
item inventory_item,
count integer
);
INSERT INTO on_hand VALUES (ROW('fuzzy dice', 42, 1.99), 1000);
```

### References
- Postgres: https://www.postgresql.org/docs/current/sql-createtype.html
- SQL server: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-type-transact-sql?view=sql-server-ver16

Contributor guide

No contributing guide indexed for this repository

Research direction

No implementation files or tests are named. Start by locating the parser entry point and AST definitions for CREATE statements, then review how dialect-specific syntax is represented. Done means composite CREATE TYPE statements such as the PostgreSQL example parse successfully with coverage for the supported syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
compilers, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.