apache / apache/shenyu

[BUG] Pervasive `SELECT true ... LIMIT 1` in `existed` checks is non-portable to Oracle

Open
#6,694 1 comment 0 reactions 0 assignees View on GitHub
priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: Medium
- files: `selector-sqlmap.xml:209-214`; `rule-sqlmap.xml:156-161`; `app-auth-sqlmap.xml:140-145,147-152`; `plugin-sqlmap.xml:136-140,142-146`; `role-sqlmap.xml:79-84`; `auth-path-sqlmap.xml:84-96`; `data-permission-sqlmap.xml:112-117`; `meta-data-sqlmap.xml:165-170`; `namespace-plugin-rel-sqlmap.xml:43-47`; `tag-sqlmap.xml:41-46`; etc.
- description: Dozens of `existed`/`*Existed` probes use `SELECT true FROM t WHERE ... LIMIT 1` returning `java.lang.Boolean`. `LIMIT 1` is invalid on Oracle (needs `ROWNUM`/`FETCH FIRST`) and `SELECT true` is not valid Oracle SQL (Oracle has no boolean type). Only `plugin` and `operation-record-log` carry `databaseId="oracle"` variants; none of these `existed` statements do.
- impact: Any `existed`/uniqueness probe throws on Oracle; the few Oracle-specific overrides show Oracle is a supported target.
- suggested_fix: Standardize on `SELECT 1 FROM ... WHERE ... LIMIT 1` (or `FETCH FIRST 1 ROWS ONLY`) and add `databaseId="oracle"` variants.
- confidence: Medium
- related_existing: partially overlaps #6161 (Oracle schema DDL) and #5631 (Oracle rule-sqlmap `;`), but this is a distinct, broad mapper-SQL portability defect across the `existed` family.

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the listed mapper files, including selector-sqlmap.xml, rule-sqlmap.xml, app-auth-sqlmap.xml, plugin-sqlmap.xml, and role-sqlmap.xml, then compare the existing databaseId="oracle" variants in plugin and operation-record-log. Trace every existed/*Existed statement in the scan list and verify that the completed mapper SQL works for both the default database and Oracle.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.