Convert Oracle date format elements that PostgreSQL misreads

Proprietary

Replaces the year elements RR and RRRR, and fractional seconds FF without a precision or with one above 6, in the format masks of TO_DATE, TO_TIMESTAMP and TO_CHAR. PostgreSQL does not reject these. It reads RR as a year of 1 BC, drops the fraction FF reads, and prints both as text. RR becomes YY, which PostgreSQL resolves to the year nearest 2020, so where Oracle reads 50 to 69 as 1950 to 1969, PostgreSQL reads 2050 to 2069. FF becomes FF6, PostgreSQL's microsecond precision.

org.openrewrite.sql.ConvertOracleDateFormat
mod run . --recipe=org.openrewrite.sql.ConvertOracleDateFormat

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.