Subject: | identifier stripping code bug affecting $rs->update (single query bulk update) |
bug is new, entered after 0.8196 (running under perl-5-14.2 perlbrew;
ubuntu 12.04)
i described it as "when i try to do a single query bulk update, passing
$rs->update( { field => 1} ), dbix::class doesn't pass in my postgres
schema name. the trace says 'update table1' instead of 'update
schema1.table1'. no such problem with $rs->update_all or any
$rs->search followed by extraction of values, they all supply
'schema1.table1' to postgres."
➜ test ./t/update_schema_call.t
1..0 # SKIP Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
# ( NOTE: This test drops and create a table called 'this_schema.item_values
# as following schema: 'this_schema'
so specify (e.g.)
export DBICTEST_PG_DSN='dbi:Pg:dbname=my_test_db
export DBICTEST_PG_USER='larry'
export DBICTEST_PG_USER='some_password'
run with DBIx::Class 0.8196:
➜ test ./t/update_schema_call.t
ok 1 - The object isa DBIx::Class::Row
ok 2 - The object isa DBIx::Class::Row
ok 3 - The object isa DBIx::Class::Row
ok 4 - The object isa DBIx::Class::Row
ok 5 - The object isa DBIx::Class::Row
ok 6 - The object isa DBIx::Class::Row
ok 7 - The object isa DBIx::Class::ResultSet
ok 8 - search on resultset OK
ok 9 - test of single query bulk update
1..9
run with DBIx::Class 0.8198:
larry@desktop test>./t/update_schema_call.t
ok 1 - The object isa DBIx::Class::Row
ok 2 - The object isa DBIx::Class::Row
ok 3 - The object isa DBIx::Class::Row
ok 4 - The object isa DBIx::Class::Row
ok 5 - The object isa DBIx::Class::Row
ok 6 - The object isa DBIx::Class::Row
ok 7 - The object isa DBIx::Class::ResultSet
ok 8 - search on resultset OK
DBIx::Class::ResultSet::update(): DBI Exception: DBD::Pg::st execute
failed: ERROR: relation "item_values" does not exist
LINE 1: UPDATE item_values SET secondary = $1 WHERE ( item = $2 )
^ [for Statement "UPDATE item_values SET secondary = ?
WHERE ( item = ? )" with ParamValues: 1='1', 2='Item 5'] at
./t/update_schema_call.t line 64
# Tests were run but no plan was declared and done_testing() was not seen.
same runs with DBIC_TRACE=1:
0.8196:
➜ test DBIC_TRACE=1 t/update_schema_call.t
<<<
SET search_path TO public:
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 1'
ok 1 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 2'
ok 2 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 3'
ok 3 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 4'
ok 4 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 5'
ok 5 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 6'
ok 6 - The object isa DBIx::Class::Row
ok 7 - The object isa DBIx::Class::ResultSet
SET search_path TO public:
SELECT me.item, me.secondary FROM this_schema.item_values me WHERE (
item = ? ): 'Item 5'
ok 8 - search on resultset OK
UPDATE this_schema.item_values SET secondary = ? WHERE ( item = ? ):
'1', 'Item 5'
ok 9 - test of single query bulk update
1..9
0.8198:
larry@desktop test>DBIC_TRACE=1 ./t/update_schema_call.t
SET search_path TO public:
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 1'
ok 1 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 2'
ok 2 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 3'
ok 3 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 4'
ok 4 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 5'
ok 5 - The object isa DBIx::Class::Row
INSERT INTO this_schema.item_values ( item) VALUES ( ? ): 'Item 6'
ok 6 - The object isa DBIx::Class::Row
ok 7 - The object isa DBIx::Class::ResultSet
SET search_path TO public:
SELECT me.item, me.secondary FROM this_schema.item_values me WHERE (
item = ? ): 'Item 5'
ok 8 - search on resultset OK
UPDATE item_values SET secondary = ? WHERE ( item = ? ): '1', 'Item 5'
DBI Exception: DBD::Pg::st execute failed: ERROR: relation
"item_values" does not exist
LINE 1: UPDATE item_values SET secondary = $1 WHERE ( item = $2 )
^ [for Statement "UPDATE item_values SET secondary = ?
WHERE ( item = ? )" with ParamValues: 1='1', 2='Item 5'] at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Schema.pm
line 1101.
DBIx::Class::Schema::throw_exception('Test::Schema=HASH(0x3439cc0)',
'DBI Exception: DBD::Pg::st execute failed: ERROR: relation "...')
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage.pm
line 112
DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::Pg=HASH(0x3c94eb8)',
'DBI Exception: DBD::Pg::st execute failed: ERROR: relation "...')
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 1315
DBIx::Class::Storage::DBI::__ANON__('DBD::Pg::st execute failed:
ERROR: relation "item_values" do...', 'DBI::st=HASH(0x3cf0130)', undef)
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 1644
DBIx::Class::Storage::DBI::_dbh_execute('DBIx::Class::Storage::DBI::Pg=HASH(0x3c94eb8)',
'DBI::db=HASH(0x3ce2cd8)', 'UPDATE item_values SET secondary = ? WHERE (
item = ? )', 'ARRAY(0x3ce0270)', 'ARRAY(0x3cef9e0)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 799
DBIx::Class::Storage::DBI::__ANON__() called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/BlockRunner.pm
line 137
DBIx::Class::Storage::BlockRunner::__ANON__() called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Try/Tiny.pm
line 71
eval {...} called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Try/Tiny.pm
line 67
Try::Tiny::try('CODE(0x3cefa88)', 'Try::Tiny::Catch=REF(0x3ce09d8)')
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/BlockRunner.pm
line 141
DBIx::Class::Storage::BlockRunner::__ANON__() called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Context/Preserve.pm
line 42
Context::Preserve::preserve_context('CODE(0x3c949f0)', 'replace',
'CODE(0x3cefff8)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/BlockRunner.pm
line 219
DBIx::Class::Storage::BlockRunner::_run('DBIx::Class::Storage::BlockRunner=HASH(0x3c90fa8)')
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/BlockRunner.pm
line 110
DBIx::Class::Storage::BlockRunner::run('DBIx::Class::Storage::BlockRunner=HASH(0x3c90fa8)')
called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 802
DBIx::Class::Storage::DBI::dbh_do(undef, undef, 'UPDATE item_values
SET secondary = ? WHERE ( item = ? )', 'ARRAY(0x3ce0270)',
'ARRAY(0x3cef9e0)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 1609
DBIx::Class::Storage::DBI::_execute('DBIx::Class::Storage::DBI::Pg=HASH(0x3c94eb8)',
'update', 'DBIx::Class::ResultSource::Table=HASH(0x3c94f48)',
'HASH(0x3cd7310)', 'HASH(0x3439d20)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Storage/DBI.pm
line 2125
DBIx::Class::Storage::DBI::update('DBIx::Class::Storage::DBI::Pg=HASH(0x3c94eb8)',
'DBIx::Class::ResultSource::Table=HASH(0x3c94f48)', 'HASH(0x3cd7310)',
'HASH(0x3439d20)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/ResultSet.pm
line 1775
DBIx::Class::ResultSet::_rs_update_delete('DBIx::Class::ResultSet=HASH(0x3c91278)',
'update', 'HASH(0x3cd7310)') called at
/home/larry/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/ResultSet.pm
line 1913
DBIx::Class::ResultSet::update('DBIx::Class::ResultSet=HASH(0x3c91278)',
'HASH(0x3cd7310)') called at ./t/update_schema_call.t line 64
# Tests were run but no plan was declared and done_testing() was not seen.
with kind regards,
Subject: | test.tbz2 |
Message body not shown because it is not plain text.