Skip to content

bug: INSERT ... RETURNING fails on qualified column when table is quoted #6437

@themixednuts

Description

@themixednuts

Another missing normalization tbl name issue on INSERT RETURNING.
Similiar: #2817 #2744 #2697

turso> create table "users" (id integer primary key, name text);
turso> insert into "users" values (1, 'a') returning "users".id, "users".name;
  × Parse error: no such table: users

turso> insert into "users" values (2, 'b') returning users.id, users.name;
  × Parse error: no such table: users

turso> delete from "users" where id = 1 returning "users".id, "users".name;
┌────┬──────┐
│ id │ name │
├────┼──────┤
│ 1  │ a    │
└────┴──────┘
turso> update "users" set name='c' where id=2 returning "users".id, "users".name;
┌────┬──────┐
│ id │ name │
├────┼──────┤
│ 2  │ c    │
└────┴──────┘
sqlite> insert into "users" values (1, 'a') returning "users".id, "users".name;
┌────┬──────┐
│ id │ name │
├────┼──────┤
│ 1  │ a    │
└────┴──────┘

INSERT stores the joined-table identifier via Name::to_string (preserves original quoting), while DELETE/UPDATE pass it through normalize_ident first — so qualified RETURNING refs only fail on INSERT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions