public inbox for [email protected]  
help / color / mirror / Atom feed
How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
5+ messages / 4 participants
[nested] [flat]

* How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
@ 2024-10-01 17:08 George Weaver <[email protected]>
  2024-10-01 17:25 ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 Christoph Moench-Tegeder <[email protected]>
  2024-10-01 17:28 ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 Tom Lane <[email protected]>
  0 siblings, 2 replies; 5+ messages in thread

From: George Weaver @ 2024-10-01 17:08 UTC (permalink / raw)
  To: pgsql-general

Good afternoon,

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';

The only reference I can find to xml_is_well_formed in the Release Notes 
(Version 15) is:

    Remove xml2 <https://www.postgresql.org/docs/15/xml2.html>'s
    |xml_is_well_formed()| function (Tom Lane)

    This function has been implemented in the core backend since
    Postgres 9.1

How do I address this in restoring the backup to 17?

Thanks,

George




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
  2024-10-01 17:08 How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
@ 2024-10-01 17:25 ` Christoph Moench-Tegeder <[email protected]>
  1 sibling, 0 replies; 5+ messages in thread

From: Christoph Moench-Tegeder @ 2024-10-01 17:25 UTC (permalink / raw)
  To: George Weaver <[email protected]>; +Cc: pgsql-general

## George Weaver ([email protected]):

> 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';
> 
> The only reference I can find to xml_is_well_formed in the Release
> Notes (Version 15) is:

That's it.
Your best option is to get rid of that module in the "old"
(PostgreSQL 13) database - maybe cou can just drop the extension
outright (because it's not really used anyways), maybe you need
to fix you code to use the new API. The minimalist workaround
would be to exclude function public.xml_is_well_formed() from
the backup (either at backup or at restore time) and point
your code to pg_catalog.xml_is_well_formed().
The fact that you are seeing that CREATE FUNCTION and not only
a CREATE EXTENSION would indicate that the function was created
manually and not as part of the extension (but pgxml.so would
match the extension) - or this is a left-over from pre-extension
days (CREATE EXTENSION was added in 9.1, so...)
I'd strongly advise to clean up the old database (if required
migrate away from the xml2 extension/functions and drop the
extensions and any manually created function referencing it),
it will safe you a lot of headache later on.

Regards,
Christoph

-- 
Spare Space






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
  2024-10-01 17:08 How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
@ 2024-10-01 17:28 ` Tom Lane <[email protected]>
  2024-10-03 15:20   ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2024-10-01 17:28 UTC (permalink / raw)
  To: George Weaver <[email protected]>; +Cc: pgsql-general

George Weaver <[email protected]> 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






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
  2024-10-01 17:08 How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
  2024-10-01 17:28 ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 Tom Lane <[email protected]>
@ 2024-10-03 15:20   ` George Weaver <[email protected]>
  2024-10-03 15:31     ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 Adrian Klaver <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: George Weaver @ 2024-10-03 15:20 UTC (permalink / raw)
  To: 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<[email protected]>  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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17
  2024-10-01 17:08 How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
  2024-10-01 17:28 ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 Tom Lane <[email protected]>
  2024-10-03 15:20   ` Re: How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
@ 2024-10-03 15:31     ` Adrian Klaver <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2024-10-03 15:31 UTC (permalink / raw)
  To: George Weaver <[email protected]>; pgsql-general

On 10/3/24 08:20, George Weaver wrote:
> Thanks Tom and Christoph,
> 
> Got it!
> 
> The function xml_valid is also gone.  Does xml_is_well_formed accomplish 
> the same objective?

Gone from where?

https://www.postgresql.org/docs/17/xml2.html

xml_valid ( document text ) → boolean

Parses the given document and returns true if the document is 
well-formed XML. (Note: this is an alias for the standard PostgreSQL 
function xml_is_well_formed(). The name xml_valid() is technically 
incorrect since validity and well-formedness have different meanings in 
XML.)

> 
> Thanks,
> 
> George

-- 
Adrian Klaver
[email protected]







^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2024-10-03 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-01 17:08 How to handle "could not find function xml_is_well_formed" when restoring database in Version 17 George Weaver <[email protected]>
2024-10-01 17:25 ` Christoph Moench-Tegeder <[email protected]>
2024-10-01 17:28 ` Tom Lane <[email protected]>
2024-10-03 15:20   ` George Weaver <[email protected]>
2024-10-03 15:31     ` Adrian Klaver <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox