Rewrites CTEs only once to prevent a spurious error

When Who What
2025-12-02 14:08:01 Bernice Southey (fyrefreez) Closed in commitfest PG19-4 with status: Committed
2025-12-02 14:08:01 Bernice Southey (fyrefreez) Changed committer to deanr
2025-11-29 16:37:22 CFbot Patch needs rebase
2025-11-26 10:52:31 Bernice Southey (fyrefreez) Changed tags to Bugfix, My First Patch
2025-11-26 10:49:49 Bernice Southey (fyrefreez) Attached mail thread CAEDh4nyD6MSH9bROhsOsuTqGAv_QceU_GDvN9WcHLtZTCYM1kA@mail.gmail.com
2025-11-26 10:49:49 Bernice Southey (fyrefreez) Created patch record