diff --git a/.mailmap b/.mailmap index ffbbe5d9b..0e993e4cb 100644 --- a/.mailmap +++ b/.mailmap @@ -45,3 +45,4 @@ Toby Corkindale Tommy Butler Ton Voon Wallace Reis +Patrick Kilter diff --git a/AUTHORS b/AUTHORS index 90f30335b..6a2cca57c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -150,6 +150,7 @@ Olly Betts osfameron: Hakim Cassimally ovid: Curtis "Ovid" Poe oyse: Øystein Torget +Patrick Kilter paulm: Paul Makepeace penguin: K J Cheetham perigrin: Chris Prather diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index f6057d5d6..2a34dc6cd 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -54,6 +54,31 @@ in this error message. In particular make sure that the package declaration is correct. For example, for a schema C< MySchema > you need to specify a fully qualified namespace: C< package MySchema::MyTable; >. +=head2 fix ambiguous column references in ResultSets + +In your ResultSet are two columns named the same in different tables and +DBIx::Class does not know how to properly address them. + +Examples for given error messages: + + MySQL: the generated SQL contains an ambiguous column reference + PgSQL: column reference "name" is ambiguous + SQLite: DBD::SQLite::db prepare_cached failed: ambiguous column name: id(1) + +To avoid those errors you can make use of L +in your result set methods to address the columns properly. This function returns the current +table alias for the result source this resultset is built on, that will be used in the SQL query. +Usually it is C. + + method filter_by_type { + + my ($self, $type) = @_; + + my $me = $self->current_source_alias; + + return $self->search_rs( { "$me.type_id" => $type->id } ); + } + =head2 syntax error at or near "" ... This can happen if you have a relation whose name is a word reserved by your