sqldelight / sqldelight/sql-psi

PostgreSQL doesn't support manually creating sequences.

Open
#296 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
104
Forks
35
Avg merge
1h 11m
Merged PRs (30d)
14

Description

Dialect

PostgreSQL

Failing SQL
CREATE SEQUENCE serial START 101;
Description

Sequences are used for a lot of things in PostgreSQL. They're the underlying mechanism by which SERIAL/BIGSERIAL increment keys and they can be used to generate identity columns with GENERATED columns. We should support creating sequences like specified in the documentation.

CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] name
    [ AS data_type ]
    [ INCREMENT [ BY ] increment ]
    [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
    [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
    [ OWNED BY { table_name.column_name | NONE } ]

Until we support sequences, the full grammar of generated columns as in #295 will be incomplete.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing SQL, CREATE SEQUENCE serial START 101, and compare it with PostgreSQL's CREATE SEQUENCE documentation and grammar. Trace the SQL parser entry point for PostgreSQL statements, then verify support for the listed sequence options and the relationship to generated columns in #295. Done means the failing statement and the documented sequence forms parse successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.