Skip to content

Commit 068739f

Browse files
committed
Fix incorrect xmlschema output for types timetz and timestamptz.
The output of table_to_xmlschema() and allied functions includes a regex describing valid values for these types ... but the regex was itself invalid, as it failed to escape a literal "+" sign. Report and fix by Renan Soares Lopes. Back-patch to all supported branches. Discussion: https://postgr.es/m/7f6fabaa-3f8f-49ab-89ca-59fbfe633105@me.com
1 parent 0d3aaad commit 068739f

File tree

4 files changed

+514
-438
lines changed

4 files changed

+514
-438
lines changed

src/backend/utils/adt/xml.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3659,7 +3659,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
36593659
case TIMEOID:
36603660
case TIMETZOID:
36613661
{
3662-
const char *tz = (typeoid == TIMETZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
3662+
const char *tz = (typeoid == TIMETZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
36633663

36643664
if (typmod == -1)
36653665
appendStringInfo(&result,
@@ -3682,7 +3682,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
36823682
case TIMESTAMPOID:
36833683
case TIMESTAMPTZOID:
36843684
{
3685-
const char *tz = (typeoid == TIMESTAMPTZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
3685+
const char *tz = (typeoid == TIMESTAMPTZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
36863686

36873687
if (typmod == -1)
36883688
appendStringInfo(&result,

0 commit comments

Comments
 (0)