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

Commite4a6bd2

Browse files
committed
Fix pg_dump to add the required OPERATOR() decoration to schema-qualified
operator names. This is needed when dumping operator definitions that haveCOMMUTATOR (or similar) links to operators in other schemas.Apparently Daniel Whitter is the first person ever to try this :-(
1 parent894829a commite4a6bd2

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.425 2006/01/06 19:08:33 momjian Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.426 2006/01/09 21:16:17 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -6054,9 +6054,10 @@ convertRegProcReference(const char *proc)
60546054
*
60556055
* Returns what to print, or NULL to print nothing
60566056
*
6057-
* In 7.3 the input is a REGOPERATOR display; we have to strip the
6058-
* argument-types part. In prior versions, the input is just a
6059-
* numeric OID, which we search our operator list for.
6057+
* In 7.3 and up the input is a REGOPERATOR display; we have to strip the
6058+
* argument-types part, and add OPERATOR() decoration if the name is
6059+
* schema-qualified. In older versions, the input is just a numeric OID,
6060+
* which we search our operator list for.
60606061
*/
60616062
staticconstchar*
60626063
convertOperatorReference(constchar*opr)
@@ -6070,23 +6071,34 @@ convertOperatorReference(const char *opr)
60706071
if (g_fout->remoteVersion >=70300)
60716072
{
60726073
char*name;
6073-
char*paren;
6074+
char*oname;
6075+
char*ptr;
60746076
boolinquote;
6077+
boolsawdot;
60756078

60766079
name=strdup(opr);
6077-
/* find non-double-quoted left paren */
6080+
/* find non-double-quoted left paren, and check for non-quoted dot */
60786081
inquote= false;
6079-
for (paren=name;*paren;paren++)
6082+
sawdot= false;
6083+
for (ptr=name;*ptr;ptr++)
60806084
{
6081-
if (*paren=='('&& !inquote)
6085+
if (*ptr=='"')
6086+
inquote= !inquote;
6087+
elseif (*ptr=='.'&& !inquote)
6088+
sawdot= true;
6089+
elseif (*ptr=='('&& !inquote)
60826090
{
6083-
*paren='\0';
6091+
*ptr='\0';
60846092
break;
60856093
}
6086-
if (*paren=='"')
6087-
inquote= !inquote;
60886094
}
6089-
returnname;
6095+
/* If not schema-qualified, don't need to add OPERATOR() */
6096+
if (!sawdot)
6097+
returnname;
6098+
oname=malloc(strlen(name)+11);
6099+
sprintf(oname,"OPERATOR(%s)",name);
6100+
free(name);
6101+
returnoname;
60906102
}
60916103

60926104
oprInfo=findOprByOid(atooid(opr));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp