Don't create a view on system catalogs, it will prevent you from upgrading with pg_upgrade
.
Use a function that either composes the query with dynamic SQL or executes different static queries based on the server version. You can then define a view using that function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…