Skip to content

Avoid back ticks on INSERT INTO columns with mode POSTGRESQL #630

@bertrandjamin

Description

@bertrandjamin

Hi,

I have a problem on parsing and build an INSERT INTO query using Context::SQL_MODE_POSTGRESQL.

Given this code

$query = "INSERT INTO foo (bar, baz) VALUES ('bar', 'baz');";
Context::setMode(Context::SQL_MODE_POSTGRESQL);
$parser = new Parser($query,true);
die($parser->statements[0]->build());

The printed result is :

INSERT INTO foo(`bar`, `baz`) VALUES ('bar', 'baz')

As we can see there are back ticks around the column names. But this format is not allowed on PostgreSQL.

I tough that the line Context::setMode(Context::SQL_MODE_POSTGRESQL); should resolve this.

Did I miss something ?
Is there a way to configure the lib so the columns will be encapsulated with double quotes ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions