Re: pg_dump misses comments on NOT NULL constraints
От | jian he |
---|---|
Тема | Re: pg_dump misses comments on NOT NULL constraints |
Дата | |
Msg-id | CACJufxGt_enGxs==KM=mnBzTOJ8Ytc06nw6zp53ihHKiZ_pGuw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pg_dump misses comments on NOT NULL constraints (Fujii Masao <masao.fujii@oss.nttdata.com>) |
Список | pgsql-hackers |
On Wed, Jun 25, 2025 at 11:04 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote: > >> > >> This commit corrects the behavior by ensuring CREATE TABLE LIKE to also copy > >> the comments on NOT NULL constraints when INCLUDING COMMENTS is specified. > > > > LGTM. I'd add a line in the test showing that these comments are copied > > even if INCLUDING CONSTRAINTS is not given, > > +1 to adding that test. > > CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1); > \d+ ctlt1_inh > -SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oidAND c.conrelid = 'ctlt1_inh'::regclass; > +SELECT conname, description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid= c.oid AND c.conrelid = 'ctlt1_inh'::regclass ORDER BY conname COLLATE "C"; > > However, since ctlt1_inh is created with INCLUDING COMMENTS, this test > doesn't seem to demonstrate the case you mentioned — that comments on > not-null constraints are copied even without INCLUDING CONSTRAINTS. > Am I misunderstanding? to do that, we can create another table in create_table_like.sql: CREATE TABLE noinh_con_copy2 (LIKE noinh_con_copy INCLUDING COMMENTS); or change noinh_con_copy1 definition to CREATE TABLE noinh_con_copy1 (LIKE noinh_con_copy INCLUDING COMMENTS);
В списке pgsql-hackers по дате отправления: