8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.93 2006/10/04 00:29:58 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.94 2006/10/19 22:44:11 tgl Exp $
12
12
*
13
13
* NOTES
14
14
* This cruft is the server side of PQfn.
@@ -51,6 +51,7 @@ struct fp_info
51
51
Oid namespace ; /* other stuff from pg_proc */
52
52
Oid rettype ;
53
53
Oid argtypes [FUNC_MAX_ARGS ];
54
+ char fname [NAMEDATALEN ]; /* function name for logging */
54
55
};
55
56
56
57
@@ -229,6 +230,7 @@ fetch_fp_info(Oid func_id, struct fp_info * fip)
229
230
fip -> namespace = pp -> pronamespace ;
230
231
fip -> rettype = pp -> prorettype ;
231
232
memcpy (fip -> argtypes , pp -> proargtypes .values , pp -> pronargs * sizeof (Oid ));
233
+ strlcpy (fip -> fname , NameStr (pp -> proname ), NAMEDATALEN );
232
234
233
235
ReleaseSysCache (func_htp );
234
236
@@ -316,22 +318,22 @@ HandleFunctionRequest(StringInfo msgBuf)
316
318
317
319
fid = (Oid ) pq_getmsgint (msgBuf , 4 ); /* function oid */
318
320
319
- /* Log as soon as we have the function OID */
320
- if (log_statement == LOGSTMT_ALL )
321
- {
322
- ereport (LOG ,
323
- (errmsg ("fastpath function call: function OID %u" ,
324
- fid )));
325
- was_logged = true;
326
- }
327
-
328
321
/*
329
322
* There used to be a lame attempt at caching lookup info here. Now we
330
323
* just do the lookups on every call.
331
324
*/
332
325
fip = & my_fp ;
333
326
fetch_fp_info (fid , fip );
334
327
328
+ /* Log as soon as we have the function OID and name */
329
+ if (log_statement == LOGSTMT_ALL )
330
+ {
331
+ ereport (LOG ,
332
+ (errmsg ("fastpath function call: \"%s\" (OID %u)" ,
333
+ fip -> fname , fid )));
334
+ was_logged = true;
335
+ }
336
+
335
337
/*
336
338
* Check permission to access and call function. Since we didn't go
337
339
* through a normal name lookup, we need to check schema usage too.
@@ -404,8 +406,8 @@ HandleFunctionRequest(StringInfo msgBuf)
404
406
break ;
405
407
case 2 :
406
408
ereport (LOG ,
407
- (errmsg ("duration: %s ms fastpath function call: function OID %u" ,
408
- msec_str , fid )));
409
+ (errmsg ("duration: %s ms fastpath function call: \"%s\" ( OID %u) " ,
410
+ msec_str , fip -> fname , fid )));
409
411
break ;
410
412
}
411
413
0 commit comments