[Dbix-class] MSSQL/Page/Prefetch problem

Alan Humphrey alan.humphrey at comcast.net
Fri May 29 19:44:43 GMT 2009


Hi all -

I just upgraded to version 0.08103 and have encountered a problem using page
in conjunction with prefetch against a MSSQL database.

Given:

    my $result = $schema->resultset('Surveys')->search(
        {},
        {   page     => 1,
            rows     => 25,
            order_by => ['survey_site_id', 'survey_date'],
            prefetch => 'site'
        }
    )->first();

Executing the code against MSSQL generates this error:

DBI Exception: DBD::Sybase::st execute failed: Server message number=8156
severity=16 state=1 line=1 server=SQLA4 text=The column 'comments' was
specified multiple times for 'foo'. [for Statement "  SELECT * FROM
  (
    SELECT TOP 25 * FROM
    (
        SELECT TOP 25  me.id, me.survey_site_id, me.start_time, me.end_time,
me.zero_ref_point, me.survey_date, me.weather, me.precipitation,
me.sea_state, me.tide_movement, me.visibility_distance,
me.poor_visibility_reason, me.poor_visibility_reason_other, me.equipment,
me.binocular_magnification, me.scope_magnification, me.walker_count,
me.dog_count, me.power_boat_count, me.unpowered_boat_count,
me.other_activities_name, me.other_activities_count, me.comments,
me.is_complete, me.raptor1_bird_id, me.raptor1_count, me.raptor1_affect,
me.raptor2_bird_id, me.raptor2_count, me.raptor2_affect, me.raptor3_bird_id,
me.raptor3_count, me.raptor3_affect, site.site_code, site.site_name,
site.position, site.elevation, site.comments FROM surveys me  JOIN
survey_sites site ON site.site_code = me.survey_site_id  ORDER BY
survey_site_id ASC, survey_date ASC
    ) AS foo
    ORDER BY survey_site_id DESC, survey_date DESC
  ) AS bar
   ORDER BY survey_site_id, survey_date


This used to work.  Any ideas?  Thanks!

- Alan






More information about the DBIx-Class mailing list