Re: Proposal: INSERT ... BY NAME
solai v <solai.cdac@gmail.com>
From: solai v <solai.cdac@gmail.com>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter@eisentraut.org>
Date: 2026-07-08T06:52:28Z
Lists: pgsql-hackers
Hi Ayush, I tested the patch and the feature worked as expected in my testing. Before applying the patch, INSERT ... BY NAME resulted in a syntax error because PostgreSQL only supports positional matching. After applying the patch, the same query executed successfully and the source columns were matched to the target columns by their names, even when the SELECT list was in a different order. I also tried a case where the SELECT list reordered columns with different data types (age, id, name). Without BY NAME, PostgreSQL attempted positional insertion and failed with a type mismatch error. With BY NAME, the columns were correctly matched by name and the row was inserted successfully. From my testing, the implementation behaves as described in the proposal and clearly demonstrates the benefit of name-based column matching. Thanks for working on this feature. Regards, solai