Add comprehensive test coverage for EXISTS/NOT EXISTS subquery functionality
This PR adds comprehensive test coverage for the EXISTS/NOT EXISTS subquery functionality that was already implemented in Red ORM but not thoroughly tested.
Background
Issue #578 requested the ability to use EXISTS/NOT EXISTS as subqueries in Red ORM. The functionality was already implemented via the exists, is-empty, and manual Red::AST::Function approaches, but lacked proper test coverage to ensure it works as expected.
Changes
- Added
t/89-exists-subquery.rakutestwith comprehensive test coverage for:-
.existsmethod generating correct SQL withEXISTSclauses -
.exists.notmethod generating correct SQL withNOT EXISTSclauses -
.is-emptymethod (equivalent to.exists.not) - Manual
Red::AST::Functionapproach withNOT EXISTS - Complex queries combining EXISTS checks with other conditions
-
Functionality Confirmed
All approaches mentioned in the original issue now work correctly:
# Recommended approach
my $last = StatsViewRefresh.^rs.max(*.refresh-time);
my $exists-not = StatsViewRefresh.^rs.exists.not;
Upload.^all.grep( -> $v { $exists-not OR $v.uploaded > $last }).so;
# Alternative approaches also work
StatsViewRefresh.^rs.is-empty
Red::AST::Function.new(args => [StatsViewRefresh.^rs.map(*.id).ast], func => 'NOT EXISTS')
These generate proper SQL with EXISTS/NOT EXISTS clauses as requested.
Fixes #578.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
360.zef.pm
- Triggering command:
curl --silent -L -z /home/REDACTED/.zef/store/360.zef.pm -o /home/REDACTED/.zef/store/360.zef.pm REDACTED(dns block)- Triggering command:
wget -P /home/REDACTED/.zef/store --quiet REDACTED -O /home/REDACTED/.zef/store/360.zef.pm(dns block)esm.ubuntu.com
- Triggering command:
/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.