@@ -344,7 +344,7 @@ xml_out_internal(xmltype *x, pg_enc target_encoding)
344
344
}
345
345
346
346
ereport (WARNING ,
347
- errcode (ERRCODE_INTERNAL_ERROR ),
347
+ errcode (ERRCODE_DATA_CORRUPTED ),
348
348
errmsg_internal ("could not parse XML declaration in stored value" ),
349
349
errdetail_for_xml_code (res_code ));
350
350
#endif
@@ -742,7 +742,7 @@ xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg, bool indent)
742
742
{
743
743
/* If it's a document, saving is easy. */
744
744
if (xmlSaveDoc (ctxt , doc ) == -1 || xmlerrcxt -> err_occurred )
745
- xml_ereport (xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
745
+ xml_ereport (xmlerrcxt , ERROR , ERRCODE_OUT_OF_MEMORY ,
746
746
"could not save document to xmlBuffer" );
747
747
}
748
748
else if (content_nodes != NULL )
@@ -785,15 +785,15 @@ xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg, bool indent)
785
785
if (xmlSaveTree (ctxt , newline ) == -1 || xmlerrcxt -> err_occurred )
786
786
{
787
787
xmlFreeNode (newline );
788
- xml_ereport (xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
788
+ xml_ereport (xmlerrcxt , ERROR , ERRCODE_OUT_OF_MEMORY ,
789
789
"could not save newline to xmlBuffer" );
790
790
}
791
791
}
792
792
793
793
if (xmlSaveTree (ctxt , node ) == -1 || xmlerrcxt -> err_occurred )
794
794
{
795
795
xmlFreeNode (newline );
796
- xml_ereport (xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
796
+ xml_ereport (xmlerrcxt , ERROR , ERRCODE_OUT_OF_MEMORY ,
797
797
"could not save content to xmlBuffer" );
798
798
}
799
799
}
@@ -1004,7 +1004,7 @@ xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null)
1004
1004
1005
1005
if (pg_strcasecmp (target , "xml" ) == 0 )
1006
1006
ereport (ERROR ,
1007
- (errcode (ERRCODE_SYNTAX_ERROR ), /* really */
1007
+ (errcode (ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION ),
1008
1008
errmsg ("invalid XML processing instruction" ),
1009
1009
errdetail ("XML processing instruction target name cannot be \"%s\"." , target )));
1010
1010
@@ -4383,7 +4383,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces,
4383
4383
xpath_len = VARSIZE_ANY_EXHDR (xpath_expr_text );
4384
4384
if (xpath_len == 0 )
4385
4385
ereport (ERROR ,
4386
- (errcode (ERRCODE_DATA_EXCEPTION ),
4386
+ (errcode (ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ),
4387
4387
errmsg ("empty XPath expression" )));
4388
4388
4389
4389
string = pg_xmlCharStrndup (datastr , len );
@@ -4456,7 +4456,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces,
4456
4456
*/
4457
4457
xpathcomp = xmlXPathCtxtCompile (xpathctx , xpath_expr );
4458
4458
if (xpathcomp == NULL || xmlerrcxt -> err_occurred )
4459
- xml_ereport (xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
4459
+ xml_ereport (xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4460
4460
"invalid XPath expression" );
4461
4461
4462
4462
/*
@@ -4468,7 +4468,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces,
4468
4468
*/
4469
4469
xpathobj = xmlXPathCompiledEval (xpathcomp , xpathctx );
4470
4470
if (xpathobj == NULL || xmlerrcxt -> err_occurred )
4471
- xml_ereport (xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
4471
+ xml_ereport (xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4472
4472
"could not create XPath object" );
4473
4473
4474
4474
/*
@@ -4798,7 +4798,7 @@ XmlTableSetNamespace(TableFuncScanState *state, const char *name, const char *ur
4798
4798
if (xmlXPathRegisterNs (xtCxt -> xpathcxt ,
4799
4799
pg_xmlCharStrndup (name , strlen (name )),
4800
4800
pg_xmlCharStrndup (uri , strlen (uri ))))
4801
- xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_DATA_EXCEPTION ,
4801
+ xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4802
4802
"could not set XML namespace" );
4803
4803
#else
4804
4804
NO_XML_SUPPORT ();
@@ -4820,7 +4820,7 @@ XmlTableSetRowFilter(TableFuncScanState *state, const char *path)
4820
4820
4821
4821
if (* path == '\0' )
4822
4822
ereport (ERROR ,
4823
- (errcode (ERRCODE_DATA_EXCEPTION ),
4823
+ (errcode (ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ),
4824
4824
errmsg ("row path filter must not be empty string" )));
4825
4825
4826
4826
xstr = pg_xmlCharStrndup (path , strlen (path ));
@@ -4830,7 +4830,7 @@ XmlTableSetRowFilter(TableFuncScanState *state, const char *path)
4830
4830
4831
4831
xtCxt -> xpathcomp = xmlXPathCtxtCompile (xtCxt -> xpathcxt , xstr );
4832
4832
if (xtCxt -> xpathcomp == NULL || xtCxt -> xmlerrcxt -> err_occurred )
4833
- xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_SYNTAX_ERROR ,
4833
+ xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4834
4834
"invalid XPath expression" );
4835
4835
#else
4836
4836
NO_XML_SUPPORT ();
@@ -4854,7 +4854,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, const char *path, int colnum)
4854
4854
4855
4855
if (* path == '\0' )
4856
4856
ereport (ERROR ,
4857
- (errcode (ERRCODE_DATA_EXCEPTION ),
4857
+ (errcode (ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ),
4858
4858
errmsg ("column path filter must not be empty string" )));
4859
4859
4860
4860
xstr = pg_xmlCharStrndup (path , strlen (path ));
@@ -4864,7 +4864,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, const char *path, int colnum)
4864
4864
4865
4865
xtCxt -> xpathscomp [colnum ] = xmlXPathCtxtCompile (xtCxt -> xpathcxt , xstr );
4866
4866
if (xtCxt -> xpathscomp [colnum ] == NULL || xtCxt -> xmlerrcxt -> err_occurred )
4867
- xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_DATA_EXCEPTION ,
4867
+ xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4868
4868
"invalid XPath expression" );
4869
4869
#else
4870
4870
NO_XML_SUPPORT ();
@@ -4891,7 +4891,7 @@ XmlTableFetchRow(TableFuncScanState *state)
4891
4891
{
4892
4892
xtCxt -> xpathobj = xmlXPathCompiledEval (xtCxt -> xpathcomp , xtCxt -> xpathcxt );
4893
4893
if (xtCxt -> xpathobj == NULL || xtCxt -> xmlerrcxt -> err_occurred )
4894
- xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
4894
+ xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4895
4895
"could not create XPath object" );
4896
4896
4897
4897
xtCxt -> row_count = 0 ;
@@ -4955,7 +4955,7 @@ XmlTableGetValue(TableFuncScanState *state, int colnum,
4955
4955
/* Evaluate column path */
4956
4956
xpathobj = xmlXPathCompiledEval (xtCxt -> xpathscomp [colnum ], xtCxt -> xpathcxt );
4957
4957
if (xpathobj == NULL || xtCxt -> xmlerrcxt -> err_occurred )
4958
- xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INTERNAL_ERROR ,
4958
+ xml_ereport (xtCxt -> xmlerrcxt , ERROR , ERRCODE_INVALID_ARGUMENT_FOR_XQUERY ,
4959
4959
"could not create XPath object" );
4960
4960
4961
4961
/*
0 commit comments