[Dbix-class] SQL::Abstract regression?

Stuart Dodds stuart at doddsweb.co.uk
Mon Jul 13 16:32:23 GMT 2009


I had the exact same problem today.....the only way I could fix it was
to remove the prefetch from the search.


-----Original Message-----
From: Paul Makepeace <paulm at paulm.com>
Reply-to: "DBIx::Class user and developer list"
<dbix-class at lists.scsys.co.uk>
To: DBIx::Class user and developer list <dbix-class at lists.scsys.co.uk>
Subject: [Dbix-class] SQL::Abstract regression?
Date: Mon, 13 Jul 2009 10:52:24 -0500

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"

specifically, FROM (SELECT COUNT( publication_story.uid ) AS
story_count, ... looks wrong. Or should I update my code somehow?

This error coincides with upgrading to latest DBIx::Class today.

Paul

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk




More information about the DBIx-Class mailing list