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