Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8aad333f
Commit
8aad333f
authored
Nov 15, 2008
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash of xmlconcat(NULL)
also backpatched to 8.3
parent
0656ed3d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
14 deletions
+50
-14
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+24
-14
src/test/regress/expected/xml.out
src/test/regress/expected/xml.out
+12
-0
src/test/regress/expected/xml_1.out
src/test/regress/expected/xml_1.out
+12
-0
src/test/regress/sql/xml.sql
src/test/regress/sql/xml.sql
+2
-0
No files found.
src/backend/executor/execQual.c
View file @
8aad333f
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.23
6 2008/10/31 19:37:56 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.23
7 2008/11/15 20:52:35 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -3163,13 +3163,10 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
bool
*
isNull
,
ExprDoneCond
*
isDone
)
{
XmlExpr
*
xexpr
=
(
XmlExpr
*
)
xmlExpr
->
xprstate
.
expr
;
text
*
result
;
StringInfoData
buf
;
Datum
value
;
bool
isnull
;
ListCell
*
arg
;
ListCell
*
narg
;
int
i
;
if
(
isDone
)
*
isDone
=
ExprSingleResult
;
...
...
@@ -3195,12 +3192,16 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
*
isNull
=
false
;
return
PointerGetDatum
(
xmlconcat
(
values
));
}
else
return
(
Datum
)
0
;
}
break
;
case
IS_XMLFOREST
:
{
StringInfoData
buf
;
initStringInfo
(
&
buf
);
i
=
0
;
forboth
(
arg
,
xmlExpr
->
named_args
,
narg
,
xexpr
->
arg_names
)
{
ExprState
*
e
=
(
ExprState
*
)
lfirst
(
arg
);
...
...
@@ -3215,11 +3216,25 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
argname
);
*
isNull
=
false
;
}
i
++
;
}
if
(
*
isNull
)
{
pfree
(
buf
.
data
);
return
(
Datum
)
0
;
}
else
{
text
*
result
;
result
=
cstring_to_text_with_len
(
buf
.
data
,
buf
.
len
);
pfree
(
buf
.
data
);
return
PointerGetDatum
(
result
);
}
}
break
;
/* The remaining cases don't need to set up buf */
case
IS_XMLELEMENT
:
*
isNull
=
false
;
return
PointerGetDatum
(
xmlelement
(
xmlExpr
,
econtext
));
...
...
@@ -3354,13 +3369,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
break
;
}
if
(
*
isNull
)
result
=
NULL
;
else
result
=
cstring_to_text_with_len
(
buf
.
data
,
buf
.
len
);
pfree
(
buf
.
data
);
return
PointerGetDatum
(
result
);
elog
(
ERROR
,
"unrecognized XML operation"
);
return
(
Datum
)
0
;
}
/* ----------------------------------------------------------------
...
...
src/test/regress/expected/xml.out
View file @
8aad333f
...
...
@@ -77,6 +77,18 @@ SELECT xmlconcat('<?xml version="1.1"?><foo/>', NULL, '<?xml version="1.1" stand
<?xml version="1.1"?><foo/><bar/>
(1 row)
SELECT xmlconcat(NULL);
xmlconcat
-----------
(1 row)
SELECT xmlconcat(NULL, NULL);
xmlconcat
-----------
(1 row)
SELECT xmlelement(name element,
xmlattributes (1 as one, 'deuce' as two),
'content');
...
...
src/test/regress/expected/xml_1.out
View file @
8aad333f
...
...
@@ -79,6 +79,18 @@ LINE 1: SELECT xmlconcat('<?xml version="1.1"?><foo/>', NULL, '<?xml...
^
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlconcat(NULL);
xmlconcat
-----------
(1 row)
SELECT xmlconcat(NULL, NULL);
xmlconcat
-----------
(1 row)
SELECT xmlelement(name element,
xmlattributes (1 as one, 'deuce' as two),
'content');
...
...
src/test/regress/sql/xml.sql
View file @
8aad333f
...
...
@@ -26,6 +26,8 @@ SELECT xmlconcat(1, 2);
SELECT
xmlconcat
(
'bad'
,
'<syntax'
);
SELECT
xmlconcat
(
'<foo/>'
,
NULL
,
'<?xml version="1.1" standalone="no"?><bar/>'
);
SELECT
xmlconcat
(
'<?xml version="1.1"?><foo/>'
,
NULL
,
'<?xml version="1.1" standalone="no"?><bar/>'
);
SELECT
xmlconcat
(
NULL
);
SELECT
xmlconcat
(
NULL
,
NULL
);
SELECT
xmlelement
(
name
element
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment