On Fri, May 13, 2016 at 10:50 PM, Christophe Pettus <xof(at)thebuild(dot)com>
wrote:
> PostgreSQL 9.5.2.
>
> I ran into this while doing a pgupgrade; it refused to re-import a view
> that was operating correctly on 9.2.
>
> Summary: The view text returned by pg_get_viewdef() strips some casts,
> which can result in an error in trying to recreate the view. This means
> you can't successfully recreate those views from a pg_dump.
>
Your example should work in 9.5.3; please upgrade and post back if it does
not.
David J.