kysely icon indicating copy to clipboard operation
kysely copied to clipboard

Select type does not override selectAll

Open metallicusdev opened this issue 1 year ago • 1 comments

With a query like

      .selectAll('orders')
      .select([
        sql<string>`ENCODE(ordinal_order_id::bytea, 'hex')`.as('ordinal_order_id')
      ])

I'd expect ordinal_order_id in result to be string type, but it ends up being Buffer & string. In DB, ordinal_order_id is stored as bytea, so Buffer.

metallicusdev avatar May 02 '23 21:05 metallicusdev

You're right, it should work the way you'd expect, but this one can be tricky to fix without causing typescript performance issues. If we figure out a fix, it will probably take some time. I'd suggest working around this by using a different alias.

koskimas avatar May 03 '23 14:05 koskimas