Skip to content

Lib don't scapes reserved words #71

@ddoice

Description

@ddoice

First of all, thank you for this Postgres lightweight alternative.

I have found a bug where if you have a table with reserved column names like 'offset' the query will fail because the column name is not quoted:

const event = { offset: 1 };
await sql`insert into events ${sql(event)}`;
error= Error: syntax error at or near "offset"

postgres log:

UTC [107] ERROR:  syntax error at or near "offset" at character 46
STATEMENT: insert into events (offset) values ($1)

I made a quick and dirty fix forcing 'q' to be always true in types.js line 73.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions