On Mon, Jul 13, 2009 at 12:18:04PM -0400, Rob Kinyon wrote:
> On Mon, Jul 13, 2009 at 12:11, Paul Makepeace<[email protected]> wrote:
> > On Mon, Jul 13, 2009 at 11:03 AM, Rob Kinyon<[email protected]> wrote:
> >> On Mon, Jul 13, 2009 at 11:52, Paul Makepeace<[email protected]> wrote:
> >> [snip]
> >>> 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.
> >>
> >> What do you expect to see?
> >
> > My question is what do _you_ expect to see?
> >
> >   select => [{ count => 'publication_story.uid' }, ...
> >   as => [qw/story_count ...
> >
> > I would fairly reasonably expect to produce SELECT
> > COUNT(publication_story.uid) AS story_count and not have that appear
> > in the FROM clause (?!)
> >
> > This has been working until today when I upgraded, so a recent version
> > of $module has broken this.
> 
> Note: I have no idea what you used to get, so that's why I asked what
> you expected. I don't have your query in my app, so I have no idea
> what you are using this for. And, frankly, I don't have time to parse
> a 100-term query to figure out the one thing that broke. If you tell
> me what you think you should get, you get better answers.
> 
> Problem: as => doesn't actually affect the SQL. It only provides
> $row->get_column('story_count'), not "COUNT(publication_story.uid) AS
> story_count"
> 

This is not entirely true - I use the supplied as in this case in order
to alias the internal count to the outside subquery (i.e. I need a name
to select the function result on the outside). I could have just
generated identifiers, but using the pre-supplied as seemed like a
reasonably good idea.

_______________________________________________
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/[email protected]

Reply via email to