~patrick-crews/randgen/bug961630

« back to all changes in this revision

Viewing changes to lib/GenTest/Transform/Count.pm

  • Committer: eve
  • Date: 2010-08-28 13:09:43 UTC
  • mfrom: (498.1.13 randgen-fixes)
  • Revision ID: philips@eve-20100828130943-4ekym0l7tm9bmnnm
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
33
33
# SELECT COUNT(*) FROM ... -> SELECT * FROM ...
34
34
#
35
 
# SELECT ... FROM ... -> SELECT COUNT(*) FROM ...
 
35
# SELECT ... FROM ... -> SELECT COUNT(*), ... FROM ...
36
36
#
37
37
# It avoids GROUP BY and any other aggregate functions because
38
38
# those are difficult to validate with a simple check such as 
48
48
 
49
49
        my ($select_list) = $orig_query =~ m{SELECT (.*?) FROM}sio;
50
50
 
51
 
        if ($select_list =~ m{AVG|BIT|DISTINCT|GROUP|MAX|MIN|STD|SUM|VAR}sio) {
 
51
        if ($select_list =~ m{AVG|BIT|DISTINCT|GROUP|MAX|MIN|STD|SUM|VAR|STRAIGHT_JOIN|SQL_SMALL_RESULT}sio) {
52
52
                return STATUS_WONT_HANDLE;
53
53
        } elsif ($select_list !~ m{COUNT}sio) {
54
54
                $orig_query =~ s{SELECT (.*?) FROM}{SELECT COUNT(*) , $1 FROM}sio;