| From: | maxzor <maxzor(at)maxzor(dot)eu> | 
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: Patch for "CREATE TABLE ... (LIKE ... INCLUDING COMMENTS)" | 
| Date: | 2018-12-11 12:14:19 | 
| Message-ID: | 7adad393-1bd8-7bf9-a0b4-81e196a58ef2@maxzor.eu | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
...with thunderbird plain-text sorted...
$ diff -c parse_utilcmd_old.c parse_utilcmd.c
*** parse_utilcmd_old.c	2018-12-11 12:44:52.288309000 +0100
--- parse_utilcmd.c	2018-12-11 12:44:52.208308782 +0100
***************
*** 918,923 ****
--- 918,941 ----
  						   RelationGetRelationName(relation));
  	}
+ 	/*
+ 	 * Copy the comment on the object itself, if requested.
+ 	 */
+ 	if ((table_like_clause->options & CREATE_TABLE_LIKE_COMMENTS) &&
+ 		(comment = GetComment(relation->rd_id,
+ 							  RelationRelationId,
+ 							  0)) != NULL)
+ 	{
+ 		CommentStmt *stmt = makeNode(CommentStmt);
+
+ 		stmt->objtype = get_relkind_objtype(relation->rd_rel->relkind);
+ 		stmt->object = (Node *)
list_make2(makeString(cxt->relation->schemaname),
+ 										   makeString(cxt->relation->relname));
+ 		stmt->comment = comment;
+
+ 		cxt->alist = lappend(cxt->alist, stmt);
+ 	}
+
  	tupleDesc = RelationGetDescr(relation);
  	constr = tupleDesc->constr;
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2018-12-11 13:51:39 | Re: Thinking about EXPLAIN ALTER TABLE | 
| Previous Message | maxzor | 2018-12-11 11:55:04 | Patch for "CREATE TABLE ... (LIKE ... INCLUDING COMMENTS)" |