12
12
* by PostgreSQL
13
13
*
14
14
* 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 $
16
16
*
17
17
*-------------------------------------------------------------------------
18
18
*/
@@ -6054,9 +6054,10 @@ convertRegProcReference(const char *proc)
6054
6054
*
6055
6055
* Returns what to print, or NULL to print nothing
6056
6056
*
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.
6060
6061
*/
6061
6062
static const char *
6062
6063
convertOperatorReference (const char * opr )
@@ -6070,23 +6071,34 @@ convertOperatorReference(const char *opr)
6070
6071
if (g_fout -> remoteVersion >= 70300 )
6071
6072
{
6072
6073
char * name ;
6073
- char * paren ;
6074
+ char * oname ;
6075
+ char * ptr ;
6074
6076
bool inquote ;
6077
+ bool sawdot ;
6075
6078
6076
6079
name = strdup (opr );
6077
- /* find non-double-quoted left paren */
6080
+ /* find non-double-quoted left paren, and check for non-quoted dot */
6078
6081
inquote = false;
6079
- for (paren = name ; * paren ; paren ++ )
6082
+ sawdot = false;
6083
+ for (ptr = name ; * ptr ; ptr ++ )
6080
6084
{
6081
- if (* paren == '(' && !inquote )
6085
+ if (* ptr == '"' )
6086
+ inquote = !inquote ;
6087
+ else if (* ptr == '.' && !inquote )
6088
+ sawdot = true;
6089
+ else if (* ptr == '(' && !inquote )
6082
6090
{
6083
- * paren = '\0' ;
6091
+ * ptr = '\0' ;
6084
6092
break ;
6085
6093
}
6086
- if (* paren == '"' )
6087
- inquote = !inquote ;
6088
6094
}
6089
- return name ;
6095
+ /* If not schema-qualified, don't need to add OPERATOR() */
6096
+ if (!sawdot )
6097
+ return name ;
6098
+ oname = malloc (strlen (name ) + 11 );
6099
+ sprintf (oname , "OPERATOR(%s)" , name );
6100
+ free (name );
6101
+ return oname ;
6090
6102
}
6091
6103
6092
6104
oprInfo = findOprByOid (atooid (opr ));
0 commit comments