pgsql: Make CREATE TABLE LIKE copy comments on NOT NULL constraints whe

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make CREATE TABLE LIKE copy comments on NOT NULL constraints whe
Date: 2025-06-26 11:26:57
Message-ID: E1uUkkr-003QPm-12@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)universality(at)gmail(dot)com>
Co-authored-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/127debef-e558-4784-9e24-0d5eaf91e2d1@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/81ce602d48e8b9cbc3c3a7d5b9d9ddbea7789c02

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 22 ++++++++++++++++++
src/test/regress/expected/create_table_like.out | 30 +++++++++++++++++++++----
src/test/regress/sql/create_table_like.sql | 16 +++++++++++--
3 files changed, 62 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-06-26 16:24:56 pgsql: pg_dump: include comments on valid not-null constraints, too
Previous Message Dean Rasheed 2025-06-26 09:14:29 pgsql: doc: Updates for RETURNING OLD/NEW.