Skip to content

Select -columns doesn't preserve string as raw SQL #13

@Epiphero

Description

@Epiphero

According to the documentation, "the argument to -columns can also be a string instead of an arrayref". Although it's not explicit, the example given implies that the string is then just raw SQL and isn't parsed. Regardless the example does use a comma, and any plain string with commas produces bad SQL. Here is an example script:

#!/usr/bin/env perl
use feature 'say';

use SQL::Abstract::More;

say SQL::Abstract::More
  ->new(quote_char => '"', name_sep => '.')
  ->select(
    -columns => 'table.a, table.b',
    -from    => [ 'table' ]
  );

The output is:

SELECT "table"."a, table"."b" FROM "table"

Note the "a, table" quoted identifier. The output should be:

SELECT table.a, table.b FROM "table"

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