IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 43096


Ignore:
Timestamp:
Sep 22, 2026, 3:10:37 PM (41 hours ago)
Author:
eugene
Message:

SELECT DISTINCT with UNION needs grouping parentheses in modern SQL

Location:
branches/eam_branches/ipp-pstamp-20260421/ippTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pstamp-20260421/ippTools/share/difftool_pendingcleanuprun.sql

    r34766 r43096  
    11-- does this result in too many entries (one for each diffInputSkyfile?)
    22-- all of this is just to get the camera used for the diff run
    3 SELECT DISTINCT * FROM
    4    (SELECT DISTINCT
     3SELECT * FROM
     4   ((SELECT DISTINCT
    55            diffRun.diff_id,
    66            rawExp.camera,
    … …  
    3131             diffRun.state = 'goto_scrubbed' OR
    3232             diffRun.state = 'goto_purged')
    33         @INNERLIMITS@
     33        @INNERLIMITS@)
    3434     UNION
    35      SELECT DISTINCT
     35     (SELECT DISTINCT
    3636            diffRun.diff_id,
    3737            rawExp.camera,
    … …  
    6262             diffRun.state = 'goto_scrubbed' OR
    6363             diffRun.state = 'goto_purged')
    64         @INNERLIMITS@
     64        @INNERLIMITS@)
    6565     UNION
    66      SELECT DISTINCT
     66     (SELECT DISTINCT
    6767            diffRun.diff_id,
    6868            rawExp.camera,
    … …  
    9393             diffRun.state = 'goto_scrubbed' OR
    9494             diffRun.state = 'goto_purged')
    95         @INNERLIMITS@
     95        @INNERLIMITS@)
    9696     UNION
    97      SELECT DISTINCT
     97     (SELECT DISTINCT
    9898            diffRun.diff_id,
    9999            rawExp.camera,
    … …  
    124124             diffRun.state = 'goto_scrubbed' OR
    125125             diffRun.state = 'goto_purged')
    126         @INNERLIMITS@
     126        @INNERLIMITS@)
    127127        ) as Foo
    128128        WHERE 1
  • branches/eam_branches/ipp-pstamp-20260421/ippTools/src/difftool.c

    r43013 r43096  
    28832883    if (limit) {
    28842884        psString limitString = psDBGenerateLimitSQL(limit);
    2885         psStringAppend(&query, " %s", limitString);
    2886         psStringSubstitute(&query,limitString,"@INNERLIMITS@");
     2885        // psStringAppend(&query, " %s", limitString);
     2886        psStringSubstitute(&query, limitString, "@INNERLIMITS@");
    28872887        psFree(limitString);
    28882888
    28892889    }
    28902890    else {
    2891       psStringSubstitute(&query,NULL,"@INNERLIMITS@");
     2891      psStringSubstitute(&query ,NULL, "@INNERLIMITS@");
    28922892    }
    28932893    //    fprintf(stderr,"%s",query);
Note: See TracChangeset for help on using the changeset viewer.