Skip to content

Commit 840729f

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 1f5ef5a commit 840729f

File tree

4 files changed

+514
-438
lines changed

4 files changed

+514
-438
lines changed

src/backend/utils/adt/xml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3673,7 +3673,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
36733673
case TIMEOID:
36743674
case TIMETZOID:
36753675
{
3676-
const char *tz = (typeoid == TIMETZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
3676+
const char *tz = (typeoid == TIMETZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
36773677

36783678
if (typmod == -1)
36793679
appendStringInfo(&result,
@@ -3696,7 +3696,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
36963696
case TIMESTAMPOID:
36973697
case TIMESTAMPTZOID:
36983698
{
3699-
const char *tz = (typeoid == TIMESTAMPTZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
3699+
const char *tz = (typeoid == TIMESTAMPTZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
37003700

37013701
if (typmod == -1)
37023702
appendStringInfo(&result,

0 commit comments

Comments
 (0)