Skip to content

Inconsistent quoting of identifiers?! #11

@XSven

Description

@XSven

I have a csv file data/cities.csv. I am using the DBI tables() method to list the qualified tables:

perl -MDBI -E "say DBI->connect( 'DBI:CSV:', undef, undef, { f_dir => 'data', f_ext => '.csv/r', f_schema => 'foo' } )->tables('%', '%', '%', 'TABLE');"
"foo".cities

The schema foo is quoted but the cities table name is not!

I am now trying to prepare the same qualified table name using the DBI quote_identifier() method

perl -MDBI -E "\$dbh = DBI->connect( 'DBI:CSV:', undef, undef, { f_dir => 'data', f_ext => '.csv/r', f_schema => 'foo' } ); say \$dbh->quote_identifier(undef, \$dbh->{f_schema}, 'cities')"
"foo"."cities"

This time both the schema foo and the table name cities is quoted. That's what I have expected too when listing the tables.

My solution:

SQL_IDENTIFIER_QUOTE_CHAR is undefined. After assigning the double quote character " to it the table listing is as expected.

perl -MDBI -E "say DBI->connect( 'DBI:CSV:', undef, undef, { f_dir => 'data', f_ext => '.csv/r', f_schema => 'foo' } )->tables('%', '%', '%', 'TABLE');"
"foo"."cities"

I haven't investigated the sideeffects that a change of SQL_IDENTIFIER_QUOTE_CHAR might cause.

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