Hi, On Fri, 10 Jul 2026 at 20:15, Marcos Pegoraro <[email protected]> wrote:
> Em sex., 3 de jul. de 2026 às 08:08, Ayush Tiwari < > [email protected]> escreveu: > >> - BY NAME requires a query source and is rejected for VALUES and DEFAULT >> VALUES. BY POSITION is accepted with DEFAULT VALUES as a no-op. >> > Is it rejected for VALUES, even if those VALUES are named ? > This one should work, doesn't it ? > insert into t1 (c1, c2) by name select * from (Values (1,2)) x(c2, c1) > Yes, it works, the source there is a SELECT, not a bare VALUES list, so the aliased columns c2/c1 give BY NAME real names to match on: insert into t1 (c1, c2) by name select * from (Values (1,2)) x(c2, c1); -- c1=2, c2=1 Only the *bare* VALUES form is rejected, since a VALUES row has no column names of its own. Maybe I'll reword the docs to make that distinction clear. And is missing a test for select *, right ? > create table a(a int, b int, c int); > create table b(b int, c int, a int); > insert into a by name select * from b; > Good catch, that path isn't tested. It works (the star expands to b's column names before matching), so I'll add a regression test for it. Thanks for the review! Regards, Ayush
