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 */
60616062static const char *
60626063convertOperatorReference (const char * opr )
@@ -6070,23 +6071,34 @@ convertOperatorReference(const char *opr)
60706071if (g_fout -> remoteVersion >=70300 )
60716072{
60726073char * name ;
6073- char * paren ;
6074+ char * oname ;
6075+ char * ptr ;
60746076bool inquote ;
6077+ bool sawdot ;
60756078
60766079name = strdup (opr );
6077- /* find non-double-quoted left paren */
6080+ /* find non-double-quoted left paren, and check for non-quoted dot */
60786081inquote = 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+ else if (* ptr == '.' && !inquote )
6088+ sawdot = true;
6089+ else if (* ptr == '(' && !inquote )
60826090{
6083- * paren = '\0' ;
6091+ * ptr = '\0' ;
60846092break ;
60856093}
6086- if (* paren == '"' )
6087- inquote = !inquote ;
60886094}
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 ;
60906102}
60916103
60926104oprInfo = findOprByOid (atooid (opr ));