pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alex Liapychev <coder.sam@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: tomas@vondra.me, tgl@sss.pgh.pa.us, matheusssilv97 <matheusssilv97@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>
Cc: masao.fujii <masao.fujii@gmail.com>
Cc: david.g.johnston <david.g.johnston@gmail.com>
Cc: tgl <tgl@sss.pgh.pa.us>
Cc: huseyin.d3r <huseyin.d3r@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: chochoforwork@gmail.com
Cc: 44973863@qq.com
Subject: Re: COMMENTS are not being copied in CREATE TABLE LIKE
Date: Thu, 1 Oct 2026 23:13:58 +0200
Message-ID: <245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com> (raw)
In-Reply-To: <6cc4ef4b-f997-4453-ab40-bc012d342fa0@uni-muenster.de>
References: <e08cb97f-0364-4002-9cda-3c16b42e4136@uni-muenster.de>
	<tencent_D0A4135EDF6E96A0D4478DABF0656D6DB408@qq.com>
	<2d41978b-3bca-4756-b0a0-b6e707ad7793@uni-muenster.de>
	<tencent_FF05EDF384FEB7852516F57BE32C7C61DB06@qq.com>
	<88b16128-d6f4-4a7b-a29a-fa0cd1c2084f@uni-muenster.de>
	<tencent_28945AA8110B3EA5AD8A366542E61BCA5205@qq.com>
	<65963A8C-C1EE-431E-9513-C4AD16AEE789@gmail.com>
	<223a6be3-3917-47a4-9b5d-51720c60ad58@vondra.me>
	<c8525e6e-5789-464e-a70d-b3916e4168eb@uni-muenster.de>
	<CAD4C109-0CAB-4D25-9C3B-FDC8CE375E4D@gmail.com>
	<36F56BBE-1499-4F82-AC03-05AAAE65D657@gmail.com>
	<6cc4ef4b-f997-4453-ab40-bc012d342fa0@uni-muenster.de>

Hi Jim,
Hi Tomas and Tom,


First, let me address the specific questions.
> On 1 Oct 2026, at 18:49, Jim Jones <jim.jones@uni-muenster.de> wrote:
> 
> On 01/10/2026 01:14, Alex Liapychev wrote:
>> 
>> My personal view is that adding this functionality carries more risks
>> than leaving it out. Although the code is relatively small and appears
>> to work correctly, I would not merge it into the codebase.
> 
> You mean the multiple tables scenario or the whole patch?

Yes, I meant the scenario involving multiple tables - specifically, the concatenation of their comments. 
Sorry I wasn’t clear about that here.

>> An example of how this functionality could be used maliciously:
>> 
>>  * A workflow creates a new table from several template tables in
>>    response to an event.
> 
> Can you elaborate more on this scenario? I'm afraid I didn't get your
> point here. Thanks!
> 

I meant that CREATE TABLE is executed within some automatic flow, without direct human supervision.
For example, by a cron job or application’s code that executes CREATE TABLE in response to some event.

>>  * An adversarial user with sufficient database access adds one comment
>>    to each of two template tables. The combined size of these comments
>>    exceeds |MaxAllocSize|, causing the automation to fail unexpectedly.
> 
> An "adversarial" user with enough privileges can do many things break
> it, like renaming a column causing a conflict. I see this large comment
> scenario as purely theoretical -- at least I fail to see any practical
> use case ever exhausting this limit.

Yes, this is a narrow and theoretical scenario. But introducing a way to break the application still creates a real vulnerability, even if it requires very specific conditions. The delay between the adversary’s action (adding long comments) and the resulting failure (when CREATE TABLE actually runs) makes the cause harder to identify and can help the adversary remain undetected longer. 


Second, let me explain my overall assessment.

First of all, the code itself in v4 looks good. (The question of freeing memory that I had, is answered by the Memory Contexts.)

My concern is less about the implementation itself than about whether the benefit justifies the long-term maintenance burden and the potential security risk, however theoretical.

As Tomas and Tom’s comments have highlighted, the underlying issue is the lack of a clear use case.
A concrete, practical use case would help establish whether those costs and risks are justified at all, and which alternative to concatenation to pick.

That said, this is just my assessment as a reviewer.

Thank you for your work on this patch and for taking the time to discuss these concerns.

Kind regards,
Alex Liapychev




view thread (37+ messages)  latest in thread

Message-ID: <245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com>
Permalink:  ../245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com/
Also on:    postgresql.org/message-id/245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: coder.sam@gmail.com, jim.jones@uni-muenster.de, matheusssilv97@gmail.com, li.evan.chao@gmail.com, masao.fujii@gmail.com, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, huseyin.d3r@gmail.com, chochoforwork@gmail.com, 44973863@qq.com
  Subject: Re: COMMENTS are not being copied in CREATE TABLE LIKE
  In-Reply-To: <245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com>
  References: <e08cb97f-0364-4002-9cda-3c16b42e4136@uni-muenster.de> <tencent_D0A4135EDF6E96A0D4478DABF0656D6DB408@qq.com> <2d41978b-3bca-4756-b0a0-b6e707ad7793@uni-muenster.de> <tencent_FF05EDF384FEB7852516F57BE32C7C61DB06@qq.com> <88b16128-d6f4-4a7b-a29a-fa0cd1c2084f@uni-muenster.de> <tencent_28945AA8110B3EA5AD8A366542E61BCA5205@qq.com> <65963A8C-C1EE-431E-9513-C4AD16AEE789@gmail.com> <223a6be3-3917-47a4-9b5d-51720c60ad58@vondra.me> <c8525e6e-5789-464e-a70d-b3916e4168eb@uni-muenster.de> <CAD4C109-0CAB-4D25-9C3B-FDC8CE375E4D@gmail.com> <36F56BBE-1499-4F82-AC03-05AAAE65D657@gmail.com> <6cc4ef4b-f997-4453-ab40-bc012d342fa0@uni-muenster.de> <245F8C2C-11CF-4087-B050-1726558AA4A0@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox