-my $statement = <<EOS;
-
- select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
- sysname, snapshot, b.status, stage, branch, build_flags,
- operating_system, os_version, compiler, compiler_version, architecture
- from buildsystems s,
- build_status b
- natural join
- (select sysname, branch, max(snapshot) as snapshot
- from build_status
- group by sysname, branch
- having max(snapshot) > now() - '30 days'::interval
- ) m
- where name = sysname
- and s.status = 'approved'
- order by branch = 'HEAD' desc,
- branch desc,
- snapshot desc
-
-EOS
-;
-
-$statement =<<EOS;