2026-01-09 21:02:30 +00:00
|
|
|
-- PublicreportIDTable
|
|
|
|
|
WITH found_tables AS (
|
2026-02-06 15:39:49 +00:00
|
|
|
SELECT
|
|
|
|
|
'nuisance' as table_name,
|
|
|
|
|
id
|
|
|
|
|
FROM publicreport.nuisance
|
|
|
|
|
WHERE public_id = $1
|
2026-01-09 21:02:30 +00:00
|
|
|
|
2026-02-06 15:39:49 +00:00
|
|
|
UNION ALL
|
2026-01-09 21:02:30 +00:00
|
|
|
|
2026-02-06 15:39:49 +00:00
|
|
|
SELECT
|
|
|
|
|
'pool' as table_name,
|
|
|
|
|
id
|
|
|
|
|
FROM publicreport.pool
|
|
|
|
|
WHERE public_id = $1
|
2026-01-09 21:02:30 +00:00
|
|
|
|
2026-02-06 15:39:49 +00:00
|
|
|
UNION ALL
|
2026-01-09 21:02:30 +00:00
|
|
|
|
2026-02-06 15:39:49 +00:00
|
|
|
SELECT 'quick' as table_name,
|
|
|
|
|
id
|
|
|
|
|
FROM publicreport.quick
|
|
|
|
|
WHERE public_id = $1
|
2026-01-09 21:02:30 +00:00
|
|
|
)
|
|
|
|
|
SELECT
|
2026-02-06 15:39:49 +00:00
|
|
|
EXISTS (SELECT 1 FROM found_tables) as exists_somewhere,
|
|
|
|
|
array_agg(table_name) as found_in_tables,
|
|
|
|
|
array_agg(id) as report_ids
|
2026-01-09 21:02:30 +00:00
|
|
|
FROM found_tables;
|