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
8db43db0
Commit
8db43db0
authored
Nov 09, 2007
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow XML processing instructions starting with "xml" while prohibiting
those being exactly "xml". Bug #3735 from Ben Leslie
parent
3991c3fb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
7 deletions
+53
-7
src/backend/utils/adt/xml.c
src/backend/utils/adt/xml.c
+16
-3
src/test/regress/expected/xml.out
src/test/regress/expected/xml.out
+22
-4
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
+3
-0
No files found.
src/backend/utils/adt/xml.c
View file @
8db43db0
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.5
3 2007/11/08 15:16:45
petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.5
4 2007/11/09 15:52:51
petere Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -676,11 +676,11 @@ xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null)
...
@@ -676,11 +676,11 @@ xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null)
xmltype
*
result
;
xmltype
*
result
;
StringInfoData
buf
;
StringInfoData
buf
;
if
(
pg_str
ncasecmp
(
target
,
"xml"
,
3
)
==
0
)
if
(
pg_str
casecmp
(
target
,
"xml"
)
==
0
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
/* really */
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
/* really */
errmsg
(
"invalid XML processing instruction"
),
errmsg
(
"invalid XML processing instruction"
),
errdetail
(
"XML processing instruction target name cannot
start with
\"
xml
\"
."
)));
errdetail
(
"XML processing instruction target name cannot
be
\"
%s
\"
."
,
target
)));
/*
/*
* Following the SQL standard, the null check comes after the
* Following the SQL standard, the null check comes after the
...
@@ -997,6 +997,14 @@ xml_init(void)
...
@@ -997,6 +997,14 @@ xml_init(void)
#define SKIP_XML_SPACE(p) \
#define SKIP_XML_SPACE(p) \
while (xmlIsBlank_ch(*(p))) (p)++
while (xmlIsBlank_ch(*(p))) (p)++
/* Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */
#define pg_xmlIsNameChar(c) \
(xmlIsBaseChar_ch(c) || xmlIsIdeographicQ(c) \
|| xmlIsDigit_ch(c) \
|| c == '.' || c == '-' || c == '_' || c == ':' \
|| xmlIsCombiningQ(c) \
|| xmlIsExtender_ch(c))
static
int
static
int
parse_xml_decl
(
const
xmlChar
*
str
,
size_t
*
lenp
,
parse_xml_decl
(
const
xmlChar
*
str
,
size_t
*
lenp
,
xmlChar
**
version
,
xmlChar
**
encoding
,
int
*
standalone
)
xmlChar
**
version
,
xmlChar
**
encoding
,
int
*
standalone
)
...
@@ -1004,6 +1012,7 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
...
@@ -1004,6 +1012,7 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
const
xmlChar
*
p
;
const
xmlChar
*
p
;
const
xmlChar
*
save_p
;
const
xmlChar
*
save_p
;
size_t
len
;
size_t
len
;
int
utf8len
;
xml_init
();
xml_init
();
...
@@ -1019,6 +1028,10 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
...
@@ -1019,6 +1028,10 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
if
(
xmlStrncmp
(
p
,
(
xmlChar
*
)
"<?xml"
,
5
)
!=
0
)
if
(
xmlStrncmp
(
p
,
(
xmlChar
*
)
"<?xml"
,
5
)
!=
0
)
goto
finished
;
goto
finished
;
/* This means it's a PI like <?xml-stylesheet ...?>. */
if
(
pg_xmlIsNameChar
(
xmlGetUTF8Char
(
&
p
[
5
],
&
utf8len
)))
goto
finished
;
p
+=
5
;
p
+=
5
;
/* version */
/* version */
...
...
src/test/regress/expected/xml.out
View file @
8db43db0
...
@@ -180,9 +180,15 @@ SELECT xmlpi(name foo);
...
@@ -180,9 +180,15 @@ SELECT xmlpi(name foo);
<?foo?>
<?foo?>
(1 row)
(1 row)
SELECT xmlpi(name xml
stuff
);
SELECT xmlpi(name xml);
ERROR: invalid XML processing instruction
ERROR: invalid XML processing instruction
DETAIL: XML processing instruction target name cannot start with "xml".
DETAIL: XML processing instruction target name cannot be "xml".
SELECT xmlpi(name xmlstuff);
xmlpi
--------------
<?xmlstuff?>
(1 row)
SELECT xmlpi(name foo, 'bar');
SELECT xmlpi(name foo, 'bar');
xmlpi
xmlpi
-------------
-------------
...
@@ -198,9 +204,21 @@ SELECT xmlpi(name foo, null);
...
@@ -198,9 +204,21 @@ SELECT xmlpi(name foo, null);
(1 row)
(1 row)
SELECT xmlpi(name xml
stuff
, null);
SELECT xmlpi(name xml, null);
ERROR: invalid XML processing instruction
ERROR: invalid XML processing instruction
DETAIL: XML processing instruction target name cannot start with "xml".
DETAIL: XML processing instruction target name cannot be "xml".
SELECT xmlpi(name xmlstuff, null);
xmlpi
-------
(1 row)
SELECT xmlpi(name "xml-stylesheet", 'href="mystyle.css" type="text/css"');
xmlpi
-------------------------------------------------------
<?xml-stylesheet href="mystyle.css" type="text/css"?>
(1 row)
SELECT xmlpi(name foo, ' bar');
SELECT xmlpi(name foo, ' bar');
xmlpi
xmlpi
-------------
-------------
...
...
src/test/regress/expected/xml_1.out
View file @
8db43db0
...
@@ -140,6 +140,10 @@ SELECT xmlpi(name foo);
...
@@ -140,6 +140,10 @@ SELECT xmlpi(name foo);
ERROR: unsupported XML feature
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name xml);
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name xmlstuff);
SELECT xmlpi(name xmlstuff);
ERROR: unsupported XML feature
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
DETAIL: This functionality requires the server to be built with libxml support.
...
@@ -156,10 +160,18 @@ SELECT xmlpi(name foo, null);
...
@@ -156,10 +160,18 @@ SELECT xmlpi(name foo, null);
ERROR: unsupported XML feature
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name xml, null);
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name xmlstuff, null);
SELECT xmlpi(name xmlstuff, null);
ERROR: unsupported XML feature
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name "xml-stylesheet", 'href="mystyle.css" type="text/css"');
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
SELECT xmlpi(name foo, ' bar');
SELECT xmlpi(name foo, ' bar');
ERROR: unsupported XML feature
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
DETAIL: This functionality requires the server to be built with libxml support.
...
...
src/test/regress/sql/xml.sql
View file @
8db43db0
...
@@ -61,11 +61,14 @@ SELECT xmlparse(document '<abc>x</abc>');
...
@@ -61,11 +61,14 @@ SELECT xmlparse(document '<abc>x</abc>');
SELECT
xmlpi
(
name
foo
);
SELECT
xmlpi
(
name
foo
);
SELECT
xmlpi
(
name
xml
);
SELECT
xmlpi
(
name
xmlstuff
);
SELECT
xmlpi
(
name
xmlstuff
);
SELECT
xmlpi
(
name
foo
,
'bar'
);
SELECT
xmlpi
(
name
foo
,
'bar'
);
SELECT
xmlpi
(
name
foo
,
'in?>valid'
);
SELECT
xmlpi
(
name
foo
,
'in?>valid'
);
SELECT
xmlpi
(
name
foo
,
null
);
SELECT
xmlpi
(
name
foo
,
null
);
SELECT
xmlpi
(
name
xml
,
null
);
SELECT
xmlpi
(
name
xmlstuff
,
null
);
SELECT
xmlpi
(
name
xmlstuff
,
null
);
SELECT
xmlpi
(
name
"xml-stylesheet"
,
'href="mystyle.css" type="text/css"'
);
SELECT
xmlpi
(
name
foo
,
' bar'
);
SELECT
xmlpi
(
name
foo
,
' bar'
);
...
...
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