You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DIP/reset-stuck-packages.sql

16 lines
610 B
SQL

-- Reset stuck packages to PENDING
-- Run this if packages are stuck in DOWNLOADING or PROCESSING status
-- Usage: psql -h 94.130.218.54 -p 32333 -U postgres -d RELM -f reset-stuck-packages.sql
UPDATE ted.ted_daily_package
SET download_status = 'PENDING',
error_message = 'Reset from stuck state - manual'
WHERE download_status IN ('DOWNLOADING', 'PROCESSING');
-- Show what was reset
SELECT package_identifier, year, serial_number, download_status, error_message, updated_at
FROM ted.ted_daily_package
WHERE error_message LIKE '%Reset from stuck state%'
ORDER BY year DESC, serial_number DESC
LIMIT 10;