Re: add tab-complete for ALTER DOMAIN ADD... - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: add tab-complete for ALTER DOMAIN ADD...
Date
Msg-id 87zffzw747.fsf@wibble.ilmari.org
Whole thread Raw
In response to add tab-complete for ALTER DOMAIN ADD...  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
jian he <jian.universality@gmail.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



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Fix slot synchronization with two_phase decoding enabled
Next
From: "songjinzhou"
Date:
Subject: libpq: Add PQapplicationname() function