h2database / h2database/h2database

Support for expressions inside Create Index

Open
#3,535 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.6k
Forks
1.3k
Avg merge
1d 2h
Merged PRs (30d)
9

Description

Hi,

this issue has been previously discussed here: https://github.com/sagarswathi/h2database/issues/196

In short, this kind of index can be created in other popular databases:
CREATE INDEX my_index_name ON my_table (COALESCE( column1,column2),column2)

However on H2 it fails with the syntax error:

Syntax error in SQL statement "CREATE INDEX my_index_name ON my_table (COALESCE[*]( column1,column2),column2)"; expected "ASC, DESC, NULLS, ,, )"; SQL statement:
CREATE INDEX my_index_name ON my_table (COALESCE( column1,column2),column2) [42001-210]

Are there any plans to implement expressions inside create index?

Contributor guide

No contributing guide indexed for this repository

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 by reading the prior discussion at h2database issue 196 and reproducing the reported CREATE INDEX statement against H2. Done means the expression-based index syntax is accepted while preserving the existing column-list behavior, with coverage for the COALESCE example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
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.