IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 11, 2026, 3:09:36 PM (2 months ago)
Author:
eugene
Message:

fix various SQL errors caught by more strict mysql versions, especially: force SQL to select a specific entry from non-aggregated fields when other fields are aggregated using e.g., GROUP BY

File:
1 edited

Legend:

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

    r37974 r43014  
    11-- Get list of warp-stack pairs that can be diffed
    22-- and check results against existing diffs
     3-- EAM: the output of this query should be limited to
     4-- only the fields need otherwise we have aggregation errors
    35SELECT
    46   exp_id,
    57   warp_id,
    6    filter,
    7    warpLabel,
     8--   filter,
     9--   warpLabel,
    810   warpDataGroup,
    911   Inputs.tess_id,
    1012   Inputs.skycell_id,
    11    stack_id,
    12    stackLabel,
    13    stackDataGroup,
    14    diff_id,
    15    diffLabel
     13   stack_id
     14-- these are NOT needed as an output
     15--   stackLabel, -- only used in the whereClauseString
     16--   stackDataGroup,
     17--   diff_id,
     18--   diffLabel
    1619FROM
    1720(
    1821SELECT
    19    exp_id,
    20    warp_id,
    21    rawExp.filter,
    22    warpRun.label AS warpLabel,
    23    warpRun.data_group AS warpDataGroup,
    24    warpRun.tess_id,
    25    warpSkyfile.skycell_id,
    26    MAX(stack_id) AS stack_id,
    27    stackRun.label AS stackLabel,
    28    stackRun.data_group AS stackDataGroup
     22   exp_id, -- KEEP
     23   warp_id, -- KEEP
     24   rawExp.filter, -- KEEP
     25--   warpRun.label AS warpLabel,  -- DROP?
     26   warpRun.data_group AS warpDataGroup, -- KEEP
     27   warpRun.tess_id, -- KEEP
     28   warpSkyfile.skycell_id, -- KEEP
     29   MAX(stack_id) AS stack_id -- KEEP
     30--   these two fields are only used by the whereClauseString below
     31--   and do NOT need to be SELECTed
     32--   stackRun.label AS stackLabel,
     33--   stackRun.data_group AS stackDataGroup
    2934FROM warpRun
    3035     JOIN fakeRun USING(fake_id)
     
    4651     AND stackSumSkyfile.quality = 0
    4752     AND exp_id IS NOT NULL
     53-- replaced by whereClauseString
    4854-- %s
    4955GROUP BY exp_id,warp_id,skycell_id
     
    6268WHERE
    6369diff_mode = 2
     70-- replaced by diffWhereClause
    6471-- %s
    6572) AS Diffs ON
     
    7077WHERE
    71781
    72 -- %s
     79-- replaced by joinWhereClause
     80-- %s
    7381
Note: See TracChangeset for help on using the changeset viewer.