--enable-xml instead of --with-libxml?

Started by Nikolay Samokhvalovalmost 19 years ago11 messages
#1Nikolay Samokhvalov
samokhvalov@gmail.com

Now we have --with-libxml (and USE_LIBXML constant for #ifdef-s), what
is not absolutely right: XML support is smth that is more general than
"using libxml2 library". E.g., some SQL/XML publishing functions (such
as XMLPI) do not deal with libxml2.

Also, in the future more "non-libxml" functionality could be added to
"XML support" (well, Peter's recent SQL-to-XML mapping functions prove
it).

I think it'd better to rename configure option to --enable-xml and
USE_LIBXML to ENABLE_XML. I'll do it if there are no objections.

--
Best regards,
Nikolay

#2Alvaro Herrera
alvherre@commandprompt.com
In reply to: Nikolay Samokhvalov (#1)
Re: --enable-xml instead of --with-libxml?

Nikolay Samokhvalov wrote:

Now we have --with-libxml (and USE_LIBXML constant for #ifdef-s), what
is not absolutely right: XML support is smth that is more general than
"using libxml2 library". E.g., some SQL/XML publishing functions (such
as XMLPI) do not deal with libxml2.

Also, in the future more "non-libxml" functionality could be added to
"XML support" (well, Peter's recent SQL-to-XML mapping functions prove
it).

I think it'd better to rename configure option to --enable-xml and
USE_LIBXML to ENABLE_XML. I'll do it if there are no objections.

I think it would be better that leaving --with-libxml out (i.e.
compiling without libxml2 support) would only disable those parts in XML
functionality that require libxml2 for their implementation; the rest of
the stuff should be compiled in regardless of the setting.

Is this not what is done currently?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Nikolay Samokhvalov (#1)
Re: --enable-xml instead of --with-libxml?

Nikolay Samokhvalov wrote:

Also, in the future more "non-libxml" functionality could be added to
"XML support" (well, Peter's recent SQL-to-XML mapping functions
prove it).

But note that those are not controlled by the --with-libxml switch.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#4Nikolay Samokhvalov
samokhvalov@gmail.com
In reply to: Alvaro Herrera (#2)
Re: --enable-xml instead of --with-libxml?

On 2/21/07, Alvaro Herrera <alvherre@commandprompt.com> wrote:

I think it would be better that leaving --with-libxml out (i.e.
compiling without libxml2 support) would only disable those parts in XML
functionality that require libxml2 for their implementation; the rest of
the stuff should be compiled in regardless of the setting.

Is this not what is done currently?

The thing is that some functions of "XML support" are based on
libxml2, some are not. libxml2 contains useful routines to deal with
XML data. Now we have: XMLELEMENT uses such routines and XMLPI
doesn't. Actually, all SQL/XML publishing function could be
implemented w/o libxml2 -- but it's more convenient to use those
routines in some cases... And there is no guarantee that functions
that don't currently use libxml2 will not use them in future.

What I want to propose is just simplification -- consider all XML
stuff as one package, including XML type, SQL/XML publishing, XPath
funcs, additional publishing functions recently added by Peter (btw,
who knows -- maybe libxml2 will help to improve them somehow in
future?), etc.

--
Best regards,
Nikolay

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Nikolay Samokhvalov (#4)
Re: --enable-xml instead of --with-libxml?

Nikolay Samokhvalov wrote:

What I want to propose is just simplification -- consider all XML
stuff as one package, including XML type, SQL/XML publishing, XPath
funcs, additional publishing functions recently added by Peter (btw,
who knows -- maybe libxml2 will help to improve them somehow in
future?), etc.

Well, in terms of predictable interfaces, there is some merit in your
argument.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#6Bruce Momjian
bruce@momjian.us
In reply to: Nikolay Samokhvalov (#4)
Re: --enable-xml instead of --with-libxml?

Where are we on this? Peter thought the consistency makes sense, but if
we can provide functionality that doesn't require libxml, why not
do it?

---------------------------------------------------------------------------

Nikolay Samokhvalov wrote:

On 2/21/07, Alvaro Herrera <alvherre@commandprompt.com> wrote:

I think it would be better that leaving --with-libxml out (i.e.
compiling without libxml2 support) would only disable those parts in XML
functionality that require libxml2 for their implementation; the rest of
the stuff should be compiled in regardless of the setting.

Is this not what is done currently?

The thing is that some functions of "XML support" are based on
libxml2, some are not. libxml2 contains useful routines to deal with
XML data. Now we have: XMLELEMENT uses such routines and XMLPI
doesn't. Actually, all SQL/XML publishing function could be
implemented w/o libxml2 -- but it's more convenient to use those
routines in some cases... And there is no guarantee that functions
that don't currently use libxml2 will not use them in future.

What I want to propose is just simplification -- consider all XML
stuff as one package, including XML type, SQL/XML publishing, XPath
funcs, additional publishing functions recently added by Peter (btw,
who knows -- maybe libxml2 will help to improve them somehow in
future?), etc.

--
Best regards,
Nikolay

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#7Nikolay Samokhvalov
nikolay@samokhvalov.com
In reply to: Bruce Momjian (#6)
Re: --enable-xml instead of --with-libxml?

On 3/27/07, Bruce Momjian <bruce@momjian.us> wrote:

Where are we on this? Peter thought the consistency makes sense, but if
we can provide functionality that doesn't require libxml, why not
do it?

I'm still for --enable-xml and putting _everything_ XML-related under this
option. My main points are:
- we cannot guarantee that existing libxml2-free functions will not require
them in the future (because libxml2 contains useful routines);
- libxml2-free functions (e.g. Peter's XML mapping functions,
http://momjian.us/main/writings/pgsql/sgml/functions-xml.html#FUNCTIONS-XML-MAPPING)
produce XML values, but we cannot use XPath function for them unless we have
libxml2;
- people will make errors, trying to understand what needs libxml2, and
what doesn't -- approach "all or nothing" is simple and straightforward;

Well, it seems that I have no more arguments :-) If there is no objections,
I'll send the patch tonight.
If I am wrong and it's better to leave libxml2-free capabilities, then IMHO
we need to reflect it explicitly in the docs, what requires libxml2, and
what doesn't

--
Best regards,
Nikolay

#8Bruce Momjian
bruce@momjian.us
In reply to: Nikolay Samokhvalov (#7)
Re: --enable-xml instead of --with-libxml?

Nikolay Samokhvalov wrote:

On 3/27/07, Bruce Momjian <bruce@momjian.us> wrote:

Where are we on this? Peter thought the consistency makes sense, but if
we can provide functionality that doesn't require libxml, why not
do it?

I'm still for --enable-xml and putting _everything_ XML-related under this
option. My main points are:
- we cannot guarantee that existing libxml2-free functions will not require
them in the future (because libxml2 contains useful routines);
- libxml2-free functions (e.g. Peter's XML mapping functions,
http://momjian.us/main/writings/pgsql/sgml/functions-xml.html#FUNCTIONS-XML-MAPPING)
produce XML values, but we cannot use XPath function for them unless we have
libxml2;
- people will make errors, trying to understand what needs libxml2, and
what doesn't -- approach "all or nothing" is simple and straightforward;

Well, it seems that I have no more arguments :-) If there is no objections,
I'll send the patch tonight.
If I am wrong and it's better to leave libxml2-free capabilities, then IMHO
we need to reflect it explicitly in the docs, what requires libxml2, and
what doesn't

Agreed, let's do the later and update the documentation. Also, do we
output a helpful message if someone tries to use a libxml2 function that
isn't available.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#9Nikolay Samokhvalov
nikolay@samokhvalov.com
In reply to: Bruce Momjian (#8)
Re: --enable-xml instead of --with-libxml?

On 4/5/07, Bruce Momjian <bruce@momjian.us> wrote:

Nikolay Samokhvalov wrote:
[...]

If I am wrong and it's better to leave libxml2-free capabilities, then

IMHO

we need to reflect it explicitly in the docs, what requires libxml2, and
what doesn't

Agreed, let's do the later and update the documentation.

So, you are agreed that I am wrong :-) Well... I would be happy hear some
arguments, but I cannot insist on it :-)

Also, do we

output a helpful message if someone tries to use a libxml2 function that
isn't available.

Yep, here it is:

INSERT INTO xmltest VALUES (1, '<value>one</value>');
ERROR: no XML support in this installation

I suppose we should change it to "no libxml2 support in this installation",
shouldn't we?

--
Best regards,
Nikolay

#10Bruce Momjian
bruce@momjian.us
In reply to: Nikolay Samokhvalov (#9)
1 attachment(s)
Re: [HACKERS] --enable-xml instead of --with-libxml?

I have applied the following patch which adds documentation and an
improved error message for an installation that does not use
--with-libxml.

---------------------------------------------------------------------------

Nikolay Samokhvalov wrote:

On 4/5/07, Bruce Momjian <bruce@momjian.us> wrote:

Nikolay Samokhvalov wrote:
[...]

If I am wrong and it's better to leave libxml2-free capabilities, then

IMHO

we need to reflect it explicitly in the docs, what requires libxml2, and
what doesn't

Agreed, let's do the later and update the documentation.

So, you are agreed that I am wrong :-) Well... I would be happy hear some
arguments, but I cannot insist on it :-)

Also, do we

output a helpful message if someone tries to use a libxml2 function that
isn't available.

Yep, here it is:

INSERT INTO xmltest VALUES (1, '<value>one</value>');
ERROR: no XML support in this installation

I suppose we should change it to "no libxml2 support in this installation",
shouldn't we?

--
Best regards,
Nikolay

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachments:

/rtmp/difftext/x-diffDownload
Index: doc/src/sgml/datatype.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v
retrieving revision 1.193
diff -c -c -r1.193 datatype.sgml
*** doc/src/sgml/datatype.sgml	2 Apr 2007 15:27:02 -0000	1.193
--- doc/src/sgml/datatype.sgml	5 Apr 2007 01:42:38 -0000
***************
*** 3202,3212 ****
      advantage over storing XML data in a <type>text</type> field is that it
      checks the input values for well-formedness, and there are support
      functions to perform type-safe operations on it; see <xref
!     linkend="functions-xml">.
     </para>
  
     <para>
!     In particular, the <type>xml</type> type can store well-formed
      <quote>documents</quote>, as defined by the XML standard, as well
      as <quote>content</quote> fragments, which are defined by the
      production <literal>XMLDecl? content</literal> in the XML
--- 3202,3214 ----
      advantage over storing XML data in a <type>text</type> field is that it
      checks the input values for well-formedness, and there are support
      functions to perform type-safe operations on it; see <xref
!     linkend="functions-xml">.  Use of this data type requires the
!     installation to have been built with <command>configure 
!     --with-libxml</>.
     </para>
  
     <para>
!     The <type>xml</type> type can store well-formed
      <quote>documents</quote>, as defined by the XML standard, as well
      as <quote>content</quote> fragments, which are defined by the
      production <literal>XMLDecl? content</literal> in the XML
Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.374
diff -c -c -r1.374 func.sgml
*** doc/src/sgml/func.sgml	2 Apr 2007 15:27:02 -0000	1.374
--- doc/src/sgml/func.sgml	5 Apr 2007 01:42:42 -0000
***************
*** 7511,7517 ****
     linkend="datatype-xml"> for information about the <type>xml</type>
     type.  The function-like expressions <function>xmlparse</function>
     and <function>xmlserialize</function> for converting to and from
!    type <type>xml</type> are not repeated here.
    </para>
  
    <sect2>
--- 7511,7519 ----
     linkend="datatype-xml"> for information about the <type>xml</type>
     type.  The function-like expressions <function>xmlparse</function>
     and <function>xmlserialize</function> for converting to and from
!    type <type>xml</type> are not repeated here.  Use of many of these
!    <type>xml</type> functions requires the installation to have been built
!    with <command>configure --with-libxml</>.
    </para>
  
    <sect2>
Index: src/backend/utils/adt/xml.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/xml.c,v
retrieving revision 1.39
diff -c -c -r1.39 xml.c
*** src/backend/utils/adt/xml.c	2 Apr 2007 03:49:39 -0000	1.39
--- src/backend/utils/adt/xml.c	5 Apr 2007 01:42:44 -0000
***************
*** 112,118 ****
  #define NO_XML_SUPPORT() \
  	ereport(ERROR, \
  			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
! 			 errmsg("no XML support in this installation")))
  
  
  #define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
--- 112,118 ----
  #define NO_XML_SUPPORT() \
  	ereport(ERROR, \
  			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
! 			 errmsg("feature not supported;  no libxml support in this installation")))
  
  
  #define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
#11Andrew Dunstan
andrew@dunslane.net
In reply to: Bruce Momjian (#10)
Re: [HACKERS] --enable-xml instead of --with-libxml?

Bruce Momjian wrote:

I have applied the following patch which adds documentation and an
improved error message for an installation that does not use
--with-libxml.

and you broke the buildfarm ... you need to fix the regression test.

cheers

andrew