DBIx::Lite::ResultSet outputs illegal syntax for the DELETE command when quote_char is turned on and the connection is to Postgres.
Here's an example:
#! perl
use v5.10;
use DBIx::Lite;
my $dbix = DBIx::Lite->new( abstract => { quote_char => q{"}, name_sep=> q{.} } );
$dbix->connect("dbi:Pg:dbname=$ENV{PGDATABASE};host=$ENV{PGHOST}",q{},q{});
say $dbix->table('foo')->delete_sql;
This outputs:
DELETE FROM """foo"" AS ""me"""
which when fed to Postgres results in
dj=> DELETE FROM """foo"" AS ""me""";
ERROR: relation ""foo" AS "me"" does not exist
LINE 1: DELETE FROM """foo"" AS ""me""";
^
essentially the q{"foo" as "me"} table alias phrase is being passed as a single string.
This behavior begins in DBIx::Lite::ResultSet::_table_alias_expr where DBIx::Lite::ResultSet::_table_alias is called and returns an alias of "me" for the table, hardwired because of the Pg connection and the delete statement.
It then calls SQL::Abstract::More::table_alias, where it is first quoted (via SQL::Abstract::More::_make_sub_table_alias)
and then again when it calls SQL::Abstract::More::delete, which passes the call on to SQL::Abstract::Classic::delete() where the second quoting happens.
DBIx::Lite::ResultSetoutputs illegal syntax for theDELETEcommand when quote_char is turned on and the connection is to Postgres.Here's an example:
This outputs:
DELETE FROM """foo"" AS ""me"""which when fed to Postgres results in
essentially the
q{"foo" as "me"}table alias phrase is being passed as a single string.This behavior begins in DBIx::Lite::ResultSet::_table_alias_expr where DBIx::Lite::ResultSet::_table_alias is called and returns an alias of "me" for the table, hardwired because of the Pg connection and the
deletestatement.It then calls
SQL::Abstract::More::table_alias, where it is first quoted (via SQL::Abstract::More::_make_sub_table_alias)and then again when it calls
SQL::Abstract::More::delete,which passes the call on to SQL::Abstract::Classic::delete() where the second quoting happens.