From 55df09a7c9ba330db939666e31c9f395f0c31b99 Mon Sep 17 00:00:00 2001 From: Patrick Simon Date: Fri, 17 Jul 2015 12:07:43 +0200 Subject: [PATCH 1/8] added ambiguous column description --- lib/DBIx/Class/Manual/Troubleshooting.pod | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index f6057d5d6..b5aa39b5c 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -54,6 +54,14 @@ 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 the generated SQL contains an ambiguous column reference + +In your ResultSet are two columns named the same in different Tables and +DBIx::Class does not know how to properly address theme. + +To avoid those errors you can make use of L +in your ResultSet methods to address the columns properly. + =head2 syntax error at or near "" ... This can happen if you have a relation whose name is a word reserved by your From b4b3377ce3e027a9a5981a97befbe7e9b833045d Mon Sep 17 00:00:00 2001 From: Patrick Simon Date: Mon, 20 Jul 2015 22:46:02 +0200 Subject: [PATCH 2/8] added error messages and a short code description --- lib/DBIx/Class/Manual/Troubleshooting.pod | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index b5aa39b5c..272feb87d 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -54,13 +54,30 @@ 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 the generated SQL contains an ambiguous column reference +=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 theme. +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 ResultSet methods to address the columns properly. +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 "" ... From e041bc8695a4119d20ad270805b878ba32aec342 Mon Sep 17 00:00:00 2001 From: Patrick Simon Date: Mon, 10 Aug 2015 15:08:46 +0200 Subject: [PATCH 3/8] added contact details --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 90f30335b..4fd2c3e58 100644 --- a/AUTHORS +++ b/AUTHORS @@ -150,6 +150,7 @@ Olly Betts osfameron: Hakim Cassimally ovid: Curtis "Ovid" Poe oyse: Øystein Torget +Patrick Simon paulm: Paul Makepeace penguin: K J Cheetham perigrin: Chris Prather From 91a7829ffe17d30853287308f55b15b1f6c591cd Mon Sep 17 00:00:00 2001 From: Patrick Simon Date: Mon, 10 Aug 2015 15:23:22 +0200 Subject: [PATCH 4/8] added mailmap informations --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index ffbbe5d9b..ed9c9e753 100644 --- a/.mailmap +++ b/.mailmap @@ -45,3 +45,4 @@ Toby Corkindale Tommy Butler Ton Voon Wallace Reis +Patrick Simon From 5d89de4007b8c1292c35859852f544ae6c2854e2 Mon Sep 17 00:00:00 2001 From: Patrick Kilter Date: Fri, 19 Jun 2020 09:03:50 +0200 Subject: [PATCH 5/8] request change by review --- lib/DBIx/Class/Manual/Troubleshooting.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index 272feb87d..248cf69b7 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -56,7 +56,7 @@ 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 +In your ResultSet are two columns named the same in different tables and DBIx::Class does not know how to properly address theme. Examples for given error messages: From c46d7764a570296ec1a6b24481c8ca347f3d7919 Mon Sep 17 00:00:00 2001 From: Patrick Kilter Date: Fri, 19 Jun 2020 09:04:28 +0200 Subject: [PATCH 6/8] fixed typo as requested by review --- lib/DBIx/Class/Manual/Troubleshooting.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index 248cf69b7..2a34dc6cd 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -57,7 +57,7 @@ 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 theme. +DBIx::Class does not know how to properly address them. Examples for given error messages: From b27c89ab15066e29c78f8a04bbe48b843aa32a86 Mon Sep 17 00:00:00 2001 From: Patrick Kilter Date: Wed, 24 Jun 2020 12:21:14 +0200 Subject: [PATCH 7/8] changed family name and email --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index ed9c9e753..0e993e4cb 100644 --- a/.mailmap +++ b/.mailmap @@ -45,4 +45,4 @@ Toby Corkindale Tommy Butler Ton Voon Wallace Reis -Patrick Simon +Patrick Kilter From 1b06a23cf4512e47dd844e66fb967d33bba6344c Mon Sep 17 00:00:00 2001 From: Patrick Kilter Date: Wed, 24 Jun 2020 12:21:52 +0200 Subject: [PATCH 8/8] changed family name and email --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 4fd2c3e58..6a2cca57c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -150,7 +150,7 @@ Olly Betts osfameron: Hakim Cassimally ovid: Curtis "Ovid" Poe oyse: Øystein Torget -Patrick Simon +Patrick Kilter paulm: Paul Makepeace penguin: K J Cheetham perigrin: Chris Prather