Re: Proposal: INSERT ... BY NAME

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Proposal: INSERT ... BY NAME
Date: 2026-07-08 06:52:28
Message-ID: CAF0whufQ0TgqcvkX9wmvHupA0X_UvRNw5aP5OZVYswQ_fiU=-w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-07-08 06:54:28 Re: Wrong query result w/ propgraph single lateral col reference
Previous Message Michael Paquier 2026-07-08 06:52:20 Re: Add per-backend AIO statistics