Cypher on Oracle and SQLite: coalesce() of one argument is refused (port of drivine4j#530)

Open Beginner friendly
#363 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, sql, sqlite
Domain
databases

Research direction

The bad output comes from the if name == "coalesce": branch in drivine/cypher/sql/sql_cypher_compiler.py (around line 3855), which emits COALESCE(x) for a single argument. Read that branch, then run the Cypher spec cases coalesce(n.missing), coalesce(n.name) and coalesce(null) to see the failure on SQLite. Done when one-argument coalesce compiles to valid SQL, either by emitting the bare argument or adding a NULL second argument, and those spec cases pass.

Written by the indexing model from the issue text.

Description

bug

Port of liberation-data/drivine4j#530.

coalesce() with one argument is compiled to COALESCE(x). Oracle refuses that with ORA-00938, and SQLite does too where drivine-python compiles to it. Postgres takes it. Neo4j gives [true, true] for MATCH (n:Pr) WITH n ORDER BY n.i RETURN coalesce(n.u) IS NULL over two nodes.

Where. drivine/cypher/sql/sql_cypher_compiler.py, the if name == "coalesce": branch (around line 3855): f"COALESCE({coalesced})".

Fix (as planned in drivine4j#530). With one argument, compile the argument alone, or add a NULL second argument.

Tests. The Cypher spec step that drivine4j#530 adds (coalesce(n.missing), coalesce(n.name), coalesce(null)), picked up when the spec is synced.

Dominant language
Python
Stars
1
Forks
0
Avg merge
1h 32m
Merged PRs (30d)
149

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from liberation-data/drivine-python

All issues in liberation-data/drivine-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.