Re: add tab-complete for ALTER DOMAIN ADD...

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add tab-complete for ALTER DOMAIN ADD...
Date: 2025-04-29 11:16:08
Message-ID: 87zffzw747.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jian he <jian(dot)universality(at)gmail(dot)com> writes:

> hi.
>
> per https://www.postgresql.org/docs/current/sql-alterdomain.html
>
> we can add tab-complete for ALTER DOMAIN ADD variants:
> ALTER DOMAIN sth ADD CHECK
> ALTER DOMAIN sth ADD CONSTRAINT
> ALTER DOMAIN sth ADD NOT NULL

Good catch.

> + /* ALTER DOMAIN <sth> ADD */
> + else if (Matches("ALTER", "DOMAIN", MatchAny, "ADD"))
> + COMPLETE_WITH("CONSTRAINT", "NOT NULL", "CHECK");

I think the completion for CHECK should include the opening paren too,
since that's required for the expression. We could also add completion
after CONSTRAINT <name>, like this:

else if(Matches("ALTER", "DOMAIN", MatchAny, "ADD", "CONSTRAINT", MatchAny))
COMPLETE_WITH("NOT NULL", "CHECK (");

- ilmari

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message songjinzhou 2025-04-29 11:22:02 libpq: Add PQapplicationname() function
Previous Message Amit Kapila 2025-04-29 10:56:36 Re: Fix slot synchronization with two_phase decoding enabled