38 lines
1.4 KiB
SQL
38 lines
1.4 KiB
SQL
-- Check for CreatedTime entries that might still cause parsing issues
|
|
-- Specifically looking for times that don't have a space before AM/PM
|
|
|
|
-- Find times without space before AM/PM
|
|
SELECT
|
|
'Times without space before AM/PM' as issue_type,
|
|
COUNT(*) as count
|
|
FROM "OptionsFlow_monthly"
|
|
WHERE "CreatedTime" IS NOT NULL
|
|
AND "CreatedTime"::text ~ '[0-9][AP]M$' -- Ends with digit followed by AM/PM (no space)
|
|
AND "CreatedTime"::text !~ '\s+[AP]M$'; -- Doesn't have space before AM/PM
|
|
|
|
-- Show sample of problematic entries
|
|
SELECT
|
|
"CreatedDate",
|
|
"CreatedTime",
|
|
"Symbol",
|
|
COUNT(*) as count
|
|
FROM "OptionsFlow_monthly"
|
|
WHERE "CreatedTime" IS NOT NULL
|
|
AND "CreatedTime"::text ~ '[0-9][AP]M$' -- Ends with digit followed by AM/PM (no space)
|
|
AND "CreatedTime"::text !~ '\s+[AP]M$' -- Doesn't have space before AM/PM
|
|
GROUP BY "CreatedDate", "CreatedTime", "Symbol"
|
|
ORDER BY count DESC
|
|
LIMIT 50;
|
|
|
|
-- Check for times with inconsistent spacing patterns
|
|
SELECT
|
|
'Detailed spacing analysis' as check_type,
|
|
COUNT(*) FILTER (WHERE "CreatedTime"::text ~ ':\d{2}:\d{2}[AP]M$') as no_space_seconds,
|
|
COUNT(*) FILTER (WHERE "CreatedTime"::text ~ ':\d{2}[AP]M$') as no_space_minutes,
|
|
COUNT(*) FILTER (WHERE "CreatedTime"::text ~ '\d{1,2}[AP]M$') as no_space_hour_only,
|
|
COUNT(*) FILTER (WHERE "CreatedTime"::text ~ '\s+[AP]M$') as has_space
|
|
FROM "OptionsFlow_monthly"
|
|
WHERE "CreatedTime" IS NOT NULL
|
|
AND "CreatedTime"::text ~* '[AP]M$';
|
|
|