From 7d6bc8dbe573b70d84a778e966edcc002785df5b Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Fri, 11 Oct 2024 15:27:50 +0200 Subject: [PATCH] Resolve ambiguity in SQL query --- lib/Cavil/Model/Snippets.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cavil/Model/Snippets.pm b/lib/Cavil/Model/Snippets.pm index ca8183c72..eeeeb000c 100644 --- a/lib/Cavil/Model/Snippets.pm +++ b/lib/Cavil/Model/Snippets.pm @@ -80,7 +80,7 @@ sub unclassified ($self, $options) { my $before = ''; if ($options->{before} > 0) { my $quoted = $db->dbh->quote($options->{before}); - $before = "AND id < $quoted"; + $before = "AND s.id < $quoted"; } my $confidence = ''; @@ -108,7 +108,7 @@ sub unclassified ($self, $options) { my $snippets = $db->query( "SELECT s.*, bp.embargoed, COUNT(*) OVER() AS total FROM snippets s LEFT JOIN bot_packages bp ON (bp.id = s.package) - WHERE $is_approved AND $is_classified $before $legal $confidence $timeframe ORDER BY id DESC LIMIT 10" + WHERE $is_approved AND $is_classified $before $legal $confidence $timeframe ORDER BY s.id DESC LIMIT 10" )->hashes; my $total = 0;