Skip to content

Column names with reserved keywords cause SQL syntax errors #9

@francislavoie

Description

@francislavoie

Bit of a footgun I've just ran into, we have a table with a column named key and that happens to be a reserved keyword, so we get an SQL syntax error.

The BulkInserter query builder should probably backtick-quote the columns. Pretty easy one-liner:

$cols = array_map(static fn($c) => "`{$c}`", $cols);

But maybe it should skip wrapping if already wrapped (user passed already quoted columns). I've pre-wrapped it in my case to work around this for now.

I'll do a PR later (maybe after the holidays if I remember) unless someone else gets to it first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions