COMMENT/SEC LABEL tab complete support suggests wrong SQL.

Started by Kirill Reshkeabout 1 month ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t253832
psql -h localhost -U postgres

Built from patchset v1 (message #1), October 23, 2026 at 01:13 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t253832_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253832_1 && git checkout t253832_1

Patchset v1 (message #1) is on t253832_1

Jump to latest
#1Kirill Reshke
reshkekirill@gmail.com

HI!

I noticed an issue on tab completion with LARGE OBJECT support. I am
aware that tab complete support need not to be always-correct, but
this cases are simple, so decided to fix.

The psql tab completion for COMMENT ON and SECURITY LABEL ON suggests
"IS" immediately after "LARGE OBJECT", this produces invalid SQL:

=# COMMENT ON LARGE OBJECT <TAB>
-- now COMMENT ON LARGE OBJECT IS

The same bug exists for SECURITY LABEL. SEC LABEL also missed EVENT
TRIGGER/ FOREIGN TABLE/MATERIALIZED VIEW cases.

Same bug was fixed for GRANT/REVOKE in ff0bcb248e6.

Quick sum up:
Before:
COMMENT ON LARGE OBJECT <TAB> → IS (invalid SQL)
SECURITY LABEL ON LARGE OBJECT <TAB> → IS (invalid SQL)
SECURITY LABEL ON EVENT TRIGGER <TAB> → IS (invalid SQL)
SECURITY LABEL ON FOREIGN TABLE <TAB> → IS (invalid SQL)
SECURITY LABEL ON MATERIALIZED VIEW <TAB> → IS (invalid SQL)

After:
COMMENT ON LARGE OBJECT <TAB> → OID list (correct)
SECURITY LABEL ON LARGE OBJECT <TAB> → OID list (correct)
SECURITY LABEL ON EVENT TRIGGER <TAB> → trigger name list (correct)
SECURITY LABEL ON FOREIGN TABLE <TAB> → foreign table list (correct)
SECURITY LABEL ON MATERIALIZED VIEW <TAB> → matview list (correct)

--
Best regards,
Kirill Reshke

Attachments:

t253832_1
v1-0001-psql-Fix-tab-completion-for-COMMENT-SECURITY-LABE.patchapplication/octet-stream; name=v1-0001-psql-Fix-tab-completion-for-COMMENT-SECURITY-LABE.patchDownload+24-1
#2Chao Li
li.evan.chao@gmail.com
In reply to: Kirill Reshke (#1)
Re: COMMENT/SEC LABEL tab complete support suggests wrong SQL.

On Sep 18, 2026, at 16:01, Kirill Reshke <reshkekirill@gmail.com> wrote:

HI!

I noticed an issue on tab completion with LARGE OBJECT support. I am
aware that tab complete support need not to be always-correct, but
this cases are simple, so decided to fix.

The psql tab completion for COMMENT ON and SECURITY LABEL ON suggests
"IS" immediately after "LARGE OBJECT", this produces invalid SQL:

=# COMMENT ON LARGE OBJECT <TAB>
-- now COMMENT ON LARGE OBJECT IS

The same bug exists for SECURITY LABEL. SEC LABEL also missed EVENT
TRIGGER/ FOREIGN TABLE/MATERIALIZED VIEW cases.

Same bug was fixed for GRANT/REVOKE in ff0bcb248e6.

Quick sum up:
Before:
COMMENT ON LARGE OBJECT <TAB> → IS (invalid SQL)
SECURITY LABEL ON LARGE OBJECT <TAB> → IS (invalid SQL)
SECURITY LABEL ON EVENT TRIGGER <TAB> → IS (invalid SQL)
SECURITY LABEL ON FOREIGN TABLE <TAB> → IS (invalid SQL)
SECURITY LABEL ON MATERIALIZED VIEW <TAB> → IS (invalid SQL)

After:
COMMENT ON LARGE OBJECT <TAB> → OID list (correct)
SECURITY LABEL ON LARGE OBJECT <TAB> → OID list (correct)
SECURITY LABEL ON EVENT TRIGGER <TAB> → trigger name list (correct)
SECURITY LABEL ON FOREIGN TABLE <TAB> → foreign table list (correct)
SECURITY LABEL ON MATERIALIZED VIEW <TAB> → matview list (correct)

--
Best regards,
Kirill Reshke
<v1-0001-psql-Fix-tab-completion-for-COMMENT-SECURITY-LABE.patch>

Do we also need to support SECURITY LABEL FOR provider ON LARGE OBJECT …?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/