Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 78283
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: fs5 [...] sanger.ac.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.08204



Subject: docs: avoid using reserved keyword 'inner'
Date: Tue, 10 Jul 2012 00:35:42 +0100
To: bug-DBIx-Class [...] rt.cpan.org
From: Frank Schwach <fs5 [...] sanger.ac.uk>
Download (untitled) / with headers
text/plain 1014b
in DBIx::Class::Manual::Cookbook under the heading "Correlated subqueries" the example query is shown as: my $cdrs = $schema->resultset('CD'); my $rs = $cdrs->search({ year=> { '=' => $cdrs->search( { artist_id=> { '=' => { -ident=> 'me.artist_id' } } }, { alias=> 'inner' } )->get_column('year')->max_rs->as_query, }, }); The use of the alias "inner" is unfortunate here because, at least in MySQL, this leads to a very unintuitive syntax error in the resulting SQL statement caused by using a reserved keyword ("inner"). Solution: just use a different alias, maybe "subq"? <http://search.cpan.org/%7Earodland/DBIx-Class-0.08196/lib/DBIx/Class/Manual/Cookbook.pod#___top> -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Download (untitled) / with headers
text/plain 540b
Show quoted text
> The use of the alias "inner" is unfortunate here because, at least in > MySQL, this leads to a very unintuitive syntax error > in the resulting SQL statement caused by using a reserved keyword > ("inner").
Perhaps. Fixed in https://github.com/dbsrgits/dbix-class/commit/d0489d51e. However note that this is not a problem in general, since one can (and definitley should) simply use the quote_names => 1 connection option[1] and everything will be just dandy. Cheers [1] https://metacpan.org/module/DBIx::Class::Storage::DBI#quote_names


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.