[PATCH] Improve tab completion for CREATE DOMAIN without AS
Hi,
AS is optional in CREATE DOMAIN, but psql completion currently works
only when it is present:
postgres=# CREATE DOMAIN d AS enu<Tab> -- completes enum1
postgres=# CREATE DOMAIN d enu<Tab> -- no completion
The attached patch offers data types both with and without AS. It also
offers the following clauses after the base type in either form:
COLLATE DEFAULT CONSTRAINT NOT NULL NULL CHECK (
Collation-name completion is corrected as well:
postgres=# CREATE DOMAIN d text COLLATE col<Tab>
postgres=# CREATE DOMAIN d text COLLATE coll1
The change follows the existing single-word base-type matching and does
not add completion inside DEFAULT or CHECK expressions.
Tests for both forms are included.
Regards,
Taiki Koshino
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
Hi Taiki,
I tested v1 on master (e87b024bfb8) with GNU readline.
Without AS, CREATE DOMAIN d enu<Tab> now completes the type, and
CREATE DOMAIN d enum1 <Tab><Tab> lists the same clauses as the AS form.
A schema-qualified type works too. The COLLATE change is a real fix:
on master, COLLATE col<Tab> after the base type completed nothing with
or without AS, and the old rule only fired for CREATE DOMAIN d COLLATE,
which the server rejects.
The psql TAP tests pass. Without the tab-complete.in.c change, the test
run times out at the first new CREATE DOMAIN check. pgindent is clean;
pgperltidy would join the check_completion("CH\t", ...) call onto one
line.
Looks good to me.
Regards,
Ishjaap Singh