Subject: | Postgres, select count + for update generates sql error |
my $lop = $schema->resultset('Lop')->search(
{
data_checked => {'<' => \'( CURRENT_DATE - INTERVAL \'1 week\' )' },
},
{
select => ['id'],
order_by => { -asc => ['id'] },
rows => 1,
for => 'update'
},
);
print $lop; # i want it to do count and to generate eror
SET search_path TO contrib, public;
SELECT COUNT( * ) FROM lop me WHERE ( ( data_checked < ( CURRENT_DATE -
INTERVAL '1 week' ) ) ) FOR UPDATE
DBIx::Class::ResultSet::count(): DBI Exception: DBD::Pg::st execute
failed: ERROR: SELECT FOR UPDATE/SHARE is not allowed with aggregate
functions [for Statement "SELECT COUNT( * ) FROM lop me WHERE ( (
data_checked < ( CURRENT_DATE - INTERVAL '1 week' ) ) ) FOR UPDATE" ]
SQLA - 1.63
DBIC - 0.08120