Make CREATE TABLE LIKE copy comments on NOT NULL constraints when requested.
authorFujii Masao <fujii@postgresql.org>
Thu, 26 Jun 2025 11:25:34 +0000 (20:25 +0900)
committerFujii Masao <fujii@postgresql.org>
Thu, 26 Jun 2025 11:25:34 +0000 (20:25 +0900)
commit81ce602d48e8b9cbc3c3a7d5b9d9ddbea7789c02
tree822db984c6038a0571adda7c91121fbcd0cf06ea
parent3ba9639e39ed8cf2d9dd30f6b8a3b3e9fffb9a64
Make CREATE TABLE LIKE copy comments on NOT NULL constraints when requested.

Commit 14e87ffa5c5 introduced support for adding comments to NOT NULL
constraints. However, CREATE TABLE LIKE INCLUDING COMMENTS did not copy
these comments to the new table. This was an oversight in that commit.

This commit corrects the behavior by ensuring CREATE TABLE LIKE to also copy
the comments on NOT NULL constraints when INCLUDING COMMENTS is specified.

Author: Jian He <jian.universality@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: http://postgr.es/m/127debef-e558-4784-9e24-0d5eaf91e2d1@oss.nttdata.com
src/backend/parser/parse_utilcmd.c
src/test/regress/expected/create_table_like.out
src/test/regress/sql/create_table_like.sql