Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb0cadc0

Browse files
committed
Fix regrole and regnamespace output functions to do quoting, too.
We discussed this but somehow failed to implement it...
1 parentfb1227a commitb0cadc0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/backend/utils/adt/regproc.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,12 +1642,18 @@ regroleout(PG_FUNCTION_ARGS)
16421642

16431643
result=GetUserNameFromId(roleoid, true);
16441644

1645-
if (!result)
1645+
if (result)
1646+
{
1647+
/* pstrdup is not really necessary, but it avoids a compiler warning */
1648+
result=pstrdup(quote_identifier(result));
1649+
}
1650+
else
16461651
{
16471652
/* If OID doesn't match any role, return it numerically */
16481653
result= (char*)palloc(NAMEDATALEN);
16491654
snprintf(result,NAMEDATALEN,"%u",roleoid);
16501655
}
1656+
16511657
PG_RETURN_CSTRING(result);
16521658
}
16531659

@@ -1757,12 +1763,18 @@ regnamespaceout(PG_FUNCTION_ARGS)
17571763

17581764
result=get_namespace_name(nspid);
17591765

1760-
if (!result)
1766+
if (result)
1767+
{
1768+
/* pstrdup is not really necessary, but it avoids a compiler warning */
1769+
result=pstrdup(quote_identifier(result));
1770+
}
1771+
else
17611772
{
17621773
/* If OID doesn't match any namespace, return it numerically */
17631774
result= (char*)palloc(NAMEDATALEN);
17641775
snprintf(result,NAMEDATALEN,"%u",nspid);
17651776
}
1777+
17661778
PG_RETURN_CSTRING(result);
17671779
}
17681780

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp