Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17

George Weaver <gweaver@shaw.ca>

From: George Weaver <gweaver@shaw.ca>
To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Date: 2024-10-03T15:20:28Z
Lists: pgsql-general
Thanks Tom and Christoph,

Got it!

The function xml_valid is also gone.  Does xml_is_well_formed accomplish 
the same objective?

Thanks,

George

On 01/10/2024 12:28 p.m., Tom Lane wrote:
> George Weaver<gweaver@shaw.ca>  writes:
>> I am testing upgrading from Version 13 to Version 17.  I am getting the
>> following error when trying to restore a database in Version 17 (the
>> database was backed up from Version 13 using the Version 17 pg_dump):
>>      pg_Restore: error: could not execute query: ERROR:  could not find
>>      function "xml_is_well_formed" in file "C:/Program
>>      Files/PostgreSQL/17/lib/pgxml.dll"
>>      Command was: CREATE FUNCTION public.xml_is_well_formed(text) RETURNS
>>      boolean
>>           LANGUAGE c IMMUTABLE STRICT
>>           AS '$libdir/pgxml', 'xml_is_well_formed';
> What you appear to have here is a pre-9.1 version of the xml2
> extension.  That is so old that you're going to have difficulty
> modernizing it.  We used to provide scripts for converting those
> loose objects into extensions, but we got rid of them in v13,
> figuring that after ten years their usefulness had passed.
>
> I think what you will have to do is manually drop all the xml2
> functions (look for pg_proc entries with '$libdir/pgxml' in probin)
> from the v13 database, then upgrade, then install the xml2 extension
> if you still want it.  Fortunately that module only provided functions
> not datatypes, so this shouldn't be too painful.  (Another way could
> be to manually remove those CREATE FUNCTION commands from the dump
> script.)
>
> I'm betting that this database has a lot of other deferred
> maintenance that you ought to think about while you're at it.
> If there are any other old-style extensions in there, better
> fix them up.
>
> 			regards, tom lane