Skip to content

Support Table Alias with Explicit Column Definition List for jsonb_to_recordset (e.g., AS alias(col TYPE) #1921

Description

@hanand95

Is there a native way in Kysely to define a Table Alias with an Explicit Column Definition List?
I is required for:
jsonb_to_recordset() / json_to_recordset()
jsonb_to_record() / json_to_record()

I wanted to use such join

CROSS JOIN LATERAL 
    jsonb_to_recordset(t.logs) AS log(type TEXT)

I have not found any workaround except
.crossJoin((eb) => eb.fn('jsonb_array_elements', ['logs']).as('log'))
and then select fields with "->>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelated to library's APIenhancementNew feature or requestpostgresRelated to PostgreSQL

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions