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
|
2026-03-09 18:02:22 +00:00
|
|
|
'water' as table_name,
|
2026-02-06 15:39:49 +00:00
|
|
|
id
|
2026-03-09 18:02:22 +00:00
|
|
|
FROM publicreport.water
|
2026-02-06 15:39:49 +00:00
|
|
|
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;
|