- $dbh->do('SELECT 1 FROM ' . table_name() .
- ' WHERE distribution = ? FOR UPDATE', undef, $distribution) or die $dbh->errstr;
+ $q = 'SELECT 1 AS result FROM public.locks' .
+ ' WHERE architecture = ? AND distribution = ? FOR UPDATE';
+ my $result = $dbh->selectrow_hashref($q, undef, $arch, $distribution) or die $dbh->errstr;
+ die unless $result->{'result'} == 1;