[Dbix-class] 0.08103 - call for testers!
Jose Luis Martinez
jlmartinez-lists-dbix at capside.com
Tue May 19 22:50:11 GMT 2009
Peter Rabbitson escribió:
> Greetings,
>
> The next release of DBIC will have a number of exciting improvements,
> among them proper ->count ->update and ->delete of any resultset,
> regardless of it's complexity (join, group_by, paging, etc.)
>
> While all of these improvements are logical extensions of the awesome
> as_query() feature, there might be some lurking bugs in this code.
>
> Please download and test the pre-release tarball on real world code.
> It should behave identically or better, depending on how much your
> app abuses dbic :) If no negative feedback is received, this tarball
> should appear as 0.08103 on CPAN by the end of this week.
Don't know if it's related to this last release or not (My standard
setup is the outdated Debian Etch DBIx::Class (0.07003), but I updated
to test out this new release).
I have
package DB::Subscriber
__PACKAGE__->add_columns(
"subscriber_id",
{ data_type => "INT", default_value => undef, is_nullable => 0, size
=> 10 },
"name",
{ data_type => "CHAR", default_value => "", is_nullable => 0, size =>
200 },
...
);
__PACKAGE__->set_primary_key("subscriber_id");
__PACKAGE__->has_one(
"subscribers_data",
"DB::SubscribersData",
{ "foreign.subscriber_id" => "self.subscriber_id" },
);
1;
package DB::SubscribersData;
__PACKAGE__->table("subscribers_data");
__PACKAGE__->add_columns(
"subscriber_id",
{ data_type => "INT", default_value => 0, is_nullable => 0, size => 10 },
"c001",
{
data_type => "VARCHAR",
default_value => undef,
is_nullable => 1,
size => 255,
},
...
);
__PACKAGE__->set_primary_key("subscriber_id");
__PACKAGE__->belongs_to(
"subscriber_id",
"DB::Subscribers",
{ subscriber_id => "subscriber_id" },
);
1;
At first I had:
my $set = $c->model('MailerDB::Subscribers')->search(
{},
{ 'join' => ['subscribers_data'],
'prefetch' => ['subscribers_data'],
'order_by' => "subscriber_id DESC"
}
);
$set->count();
and this worked OK.
After updating to 0.08102_05 I got this error:
DBIx::Class::ResultSet::count(): DBI Exception: DBD::mysql::st execute
failed: Duplicate column name 'subscriber_id' [for Statement "SELECT
COUNT( * ) FROM (SELECT me.subscriber_id,
subscribers_data.subscriber_id, subscribers_data.c001 FROM subscribers
me JOIN subscribers_data subscribers_data ON
subscribers_data.subscriber_id = me.subscriber_id GROUP BY
me.subscriber_id ORDER BY me.subscriber_id desc) count_subq"]
Looks like prefetch is the cause. If I comment it out, everything works
again (with performance penalty of no prefetch :().
The sub-select from the error works OK on it's own, but when you
surround it in the count(*) FROM (...), mysql doesn't like the two
columns called "subscriber_id" in the subselect :(.
New bug? Shot myself in the foot?
>
> http://rabbit.us/diff/DBIx-Class-0.08102_05.tar.gz
>
> Happy testing!
>
Cheers,
Jose Luis Martinez
jlmartinez at capside.com
More information about the DBIx-Class
mailing list