[Dbix-class] SQL::Abstract regression?

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Jul 13 17:42:03 GMT 2009


On Mon, Jul 13, 2009 at 12:24:57PM -0500, Paul Makepeace wrote:
> On Mon, Jul 13, 2009 at 12:01 PM, Peter Rabbitson<rabbit+dbic at rabbit.us> wrote:
> > On Mon, Jul 13, 2009 at 11:11:20AM -0500, Paul Makepeace wrote:
> >> On Mon, Jul 13, 2009 at 11:03 AM, Rob Kinyon<rob.kinyon at gmail.com> wrote:
> >> > On Mon, Jul 13, 2009 at 11:52, Paul Makepeace<paulm at paulm.com> 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?
> >
> > I expect to see exactly what you have pasted. Also being an ass will
> > not take you very far with support.
> 
> Sorry I wasn't intending to come across as an ass - I had said in my
> original email "specifically >here< is what looks wrong" so wasn't
> sure what Rob was getting at. Knowing what he'd expect would help me
> infer his intent.
> 
> >> I would fairly reasonably expect to produce SELECT
> >> COUNT(publication_story.uid) AS story_count and not have that appear
> >> in the FROM clause (?!)
> >
> > Read the SQL more carefully then.
> 
> I don't understand what you're getting at here. That clause is
> appearing in a FROM clause whereas it should appear in the earlier
> SELECT column list. Is that not how you're reading it?
>

What you are looking at is a subquery - a result of a SELECT is JOINed
to another table. As I said - read it more carefully, see where the
parenthesis balance out, and you'll understand what actually happen.

> >> This has been working until today when I upgraded, so a recent version
> >> of $module has broken this.
> >
> > I need you to *manually* execute the following snippet against your
> > database:
> >
> > 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
> 
> (I filled in the ?s)
> 
> mysql> 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 '%red orbit%' OR short_name LIKE '%red orbit%' ) )
> GROUP BY me.uid ORDER BY name;
> ERROR 1054 (42S22): Unknown column 'publication_story.uid' in 'field list'
> 

Now I'm being an ass - I didn't read properly what I pasted. The problem
is that I am losing a JOIN where I shouldn't. This is a clear regression
I'll fix it sometime tonight (EST). Until then either do not use prefetch
or use 08107.




More information about the DBIx-Class mailing list