Thread
Commits
-
Add tab-completion for ALTER TABLE not-nulls
- a604affaded0 19 (unreleased) landed
-
Add pg_constraint rows for not-null constraints
- 14e87ffa5c54 18.0 cited
-
Add tab-completion for ALTER TABLE ADD NOT NULL
Fujii Masao <masao.fujii@oss.nttdata.com> — 2025-06-04T14:26:59Z
Hi, psql already supports tab-completion for ALTER TABLE ADD with constraints like CHECK and UNIQUE. However, after commit 14e87ffa5c5 introduced support for adding NOT NULL constraints using ALTER TABLE ADD, tab-completion for that case was missing. The attached patch adds tab-completion support for ALTER TABLE ADD NOT NULL. Thought? Regards, -- Fujii Masao NTT DATA Japan Corporation
-
Re: Add tab-completion for ALTER TABLE ADD NOT NULL
Álvaro Herrera <alvherre@kurilemu.de> — 2025-06-04T14:38:32Z
On 2025-Jun-04, Fujii Masao wrote: > Hi, > > psql already supports tab-completion for ALTER TABLE ADD with constraints > like CHECK and UNIQUE. However, after commit 14e87ffa5c5 introduced > support for adding NOT NULL constraints using ALTER TABLE ADD, > tab-completion for that case was missing. > > The attached patch adds tab-completion support for ALTER TABLE ADD NOT NULL. > Thought? Hmm, did you rewrite the patch I posted at https://postgr.es/m/202505111448.bwbfomrymq4b@alvherre.pgsql ? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)
-
Re: Add tab-completion for ALTER TABLE ADD NOT NULL
Fujii Masao <masao.fujii@oss.nttdata.com> — 2025-06-04T15:34:58Z
On 2025/06/04 23:38, Álvaro Herrera wrote: > On 2025-Jun-04, Fujii Masao wrote: > >> Hi, >> >> psql already supports tab-completion for ALTER TABLE ADD with constraints >> like CHECK and UNIQUE. However, after commit 14e87ffa5c5 introduced >> support for adding NOT NULL constraints using ALTER TABLE ADD, >> tab-completion for that case was missing. >> >> The attached patch adds tab-completion support for ALTER TABLE ADD NOT NULL. >> Thought? > > Hmm, did you rewrite the patch I posted at > https://postgr.es/m/202505111448.bwbfomrymq4b@alvherre.pgsql > ? Oh, I missed that patch, thanks for pointing it out! COMPLETE_WITH("COLUMN", "CONSTRAINT", "CHECK", "UNIQUE", "PRIMARY KEY", - "EXCLUDE", "FOREIGN KEY"); + "NOT NULL", "EXCLUDE", "FOREIGN KEY"); } /* ALTER TABLE xxx ADD [COLUMN] yyy */ else if (Matches("ALTER", "TABLE", MatchAny, "ADD", "COLUMN", MatchAny) || - Matches("ALTER", "TABLE", MatchAny, "ADD", MatchAnyExcept("COLUMN|CONSTRAINT|CHECK|UNIQUE|PRIMARY|EXCLUDE|FOREIGN"))) + Matches("ALTER", "TABLE", MatchAny, "ADD", MatchAnyExcept("COLUMN|CONSTRAINT|CHECK|UNIQUE|PRIMARY|NOT|EXCLUDE|FOREIGN"))) COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_datatypes); /* ALTER TABLE xxx ADD CONSTRAINT yyy */ else if (Matches("ALTER", "TABLE", MatchAny, "ADD", "CONSTRAINT", MatchAny)) - COMPLETE_WITH("CHECK", "UNIQUE", "PRIMARY KEY", "EXCLUDE", "FOREIGN KEY"); + COMPLETE_WITH("CHECK", "UNIQUE", "PRIMARY KEY", "EXCLUDE", "FOREIGN KEY", "NOT NULL"); Just one small style comment: in the documentation, table constraints are listed in the order CHECK, NOT NULL, UNIQUE, PRIMARY KEY, etc. So it might be better to follow that same order in the code for consistency in all three places mentioned above. Regards, -- Fujii Masao NTT DATA Japan Corporation -
Re: Add tab-completion for ALTER TABLE ADD NOT NULL
Álvaro Herrera <alvherre@kurilemu.de> — 2025-07-03T14:55:25Z
On 2025-Jun-05, Fujii Masao wrote: > Just one small style comment: in the documentation, table constraints are > listed in the order CHECK, NOT NULL, UNIQUE, PRIMARY KEY, etc. So it might > be better to follow that same order in the code for consistency in all > three places mentioned above. Done that way, thanks. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "That sort of implies that there are Emacs keystrokes which aren't obscure. I've been using it daily for 2 years now and have yet to discover any key sequence which makes any sense." (Paul Thomas)