kysely icon indicating copy to clipboard operation
kysely copied to clipboard

Behavior when an alias matches some existing table name

Open thenbe opened this issue 1 year ago • 3 comments

Hi. I'm just wondering whether example 2 (playground link below) is expected behavior (known edge case, won't fix, etc) or if it's a bug. I skimmed through the codebase/issues but couldn't find anything similar.

Minimal reproduction

Kysely playground: link

Use case

I encountered this in a db where a view is used as a helper for some tables. For example:

await db
	.selectFrom("person_details_view as person")
	.select(["some_field_that_exists_in_table_but_does_not_exist_in_view"])
	.execute();

thenbe avatar Jul 29 '24 16:07 thenbe

That's a bug. Thanks for bringing this up!

koskimas avatar Jul 29 '24 18:07 koskimas

Might already be fixed (by accident) in the v0.28 branch.

koskimas avatar Jul 29 '24 18:07 koskimas

Might already be fixed (by accident) in the v0.28 branch.

I can reproduce the bug on the latest v0.28 branch (points to 5d38c1b52e8f at time of writing).

thenbe avatar Sep 06 '24 16:09 thenbe