Re: Patch for "CREATE TABLE ... (LIKE ... INCLUDING COMMENTS)"

Поиск
Список
Период
Сортировка
Искать
От
maxzor
Тема
Re: Patch for "CREATE TABLE ... (LIKE ... INCLUDING COMMENTS)"
Дата
Msg-id
7adad393-1bd8-7bf9-a0b4-81e196a58ef2@maxzor.eu
Ответ на
Список
Дерево обсуждения
Re: Patch for "CREATE TABLE ... (LIKE ... INCLUDING COMMENTS)" Tom Lane <tgl@sss.pgh.pa.us>
...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;


В списке pgsql-hackers по дате отправления
От: maxzor
Дата:
От: Alvaro Herrera
Дата:
FAQ