kysely icon indicating copy to clipboard operation
kysely copied to clipboard

Allow inserts to alias table names

Open mezuzza opened this issue 1 year ago • 1 comments

I'm not sure if all DBs allow this, but at least in postgres you can alias the table. The specific part of the spec that I'm referencing is this:

INSERT INTO table_name [ AS alias ]

So I can write

INSERT INTO some_schema.some_table AS some_alias (col1)
VALUES (1)

Since QueryCreator.insertInto doesn't have any overrides for AnyAliasedTable, there doesn't seem to be a way to do this.

mezuzza avatar Oct 12 '23 09:10 mezuzza

Could we use TableExpression in InsertInto and not Table?

alenap93 avatar May 11 '24 18:05 alenap93