[Dbix-class] SQL::Abstract regression?
Peter Rabbitson
rabbit+dbic at rabbit.us
Tue Jul 14 12:10:41 GMT 2009
On Mon, Jul 13, 2009 at 10:52:24AM -0500, Paul Makepeace wrote:
> I have,
>
> __PACKAGE__->has_many(publication_story => 'IDL::Schema::Story',
> 'publication_uid');
> __PACKAGE__->belongs_to(publication_type => 'IDL::Schema::CodeTree',
> 'publication_type_uid', { join_type => 'left'});
>
> my @SEARCH_WITH_STORY_COUNT_ARGS = (
> join => [qw/publication_story/],
> select => [{ count => 'publication_story.uid' }, qw/me.uid me.name
> me.short_name
> me.url me.description me.publication_type_uid me.region_uid
> me.channel_type_uid
> me.circulation me.ave1 me.ave2 me.comments/,],
> as => [qw/story_count uid name short_name url description publication_type_uid
> region_uid channel_type_uid circulation ave1 ave2 comments/],
> group_by => [qw/me.uid/],
> prefetch => [qw/publication_type region/],
> );
>
> and this is generating this wrong-looking SQL,
>
> DBIx::Class::ResultSet::search(): DBI Exception: DBD::mysql::st
> execute failed: Unknown column 'publication_story.uid' in 'field list'
> [for Statement "SELECT me.story_count, me.uid, me.name, me.short_name,
> me.url, me.description, me.publication_type_uid, me.region_uid,
> me.channel_type_uid, me.circulation, me.ave1, me.ave2, me.comments,
> publication_type.uid, publication_type.parent_uid,
> publication_type.value, publication_type.hide, publication_type.alias,
> publication_type.order_priority, publication_type.show_in_lists,
> publication_type.data_type, publication_type.cascade_data_type,
> publication_type.description, region.uid, region.parent_uid,
> region.value, region.hide, region.alias, region.order_priority,
> region.show_in_lists, region.data_type, region.cascade_data_type,
> region.description FROM (SELECT COUNT( publication_story.uid ) AS
> story_count, me.uid, me.name, me.short_name, me.url, me.description,
> me.publication_type_uid, me.region_uid, me.channel_type_uid,
> me.circulation, me.ave1, me.ave2, me.comments FROM publication me
> WHERE ( ( name LIKE ? OR short_name LIKE ? ) ) GROUP BY me.uid ORDER
> BY name) me LEFT JOIN story publication_story ON
> publication_story.publication_uid = me.uid LEFT JOIN code_tree
> publication_type ON publication_type.uid = me.publication_type_uid
> LEFT JOIN code_tree region ON region.uid = me.region_uid WHERE ( (
> name LIKE ? OR short_name LIKE ? ) ) ORDER BY name"
>
Fixed by http://dev.catalyst.perl.org/svnweb/bast/revision/?rev=7046
Please test and report any additional problems.
More information about the DBIx-Class
mailing list