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

Appearance settings

Commit 1b84441

Browse filesBrowse files
committed
Marginal improvement in logging: include the function name when logging
a fastpath function call.
1 parent 4887f5f commit 1b84441
Copy full SHA for 1b84441

File tree

Expand file treeCollapse file tree

1 file changed

+14
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-12
lines changed

‎src/backend/tcop/fastpath.c

Copy file name to clipboardExpand all lines: src/backend/tcop/fastpath.c
+14-12Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
* NOTES
1414
* This cruft is the server side of PQfn.
@@ -51,6 +51,7 @@ struct fp_info
5151
Oid namespace; /* other stuff from pg_proc */
5252
Oid rettype;
5353
Oid argtypes[FUNC_MAX_ARGS];
54+
char fname[NAMEDATALEN]; /* function name for logging */
5455
};
5556

5657

@@ -229,6 +230,7 @@ fetch_fp_info(Oid func_id, struct fp_info * fip)
229230
fip->namespace = pp->pronamespace;
230231
fip->rettype = pp->prorettype;
231232
memcpy(fip->argtypes, pp->proargtypes.values, pp->pronargs * sizeof(Oid));
233+
strlcpy(fip->fname, NameStr(pp->proname), NAMEDATALEN);
232234

233235
ReleaseSysCache(func_htp);
234236

@@ -316,22 +318,22 @@ HandleFunctionRequest(StringInfo msgBuf)
316318

317319
fid = (Oid) pq_getmsgint(msgBuf, 4); /* function oid */
318320

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-
328321
/*
329322
* There used to be a lame attempt at caching lookup info here. Now we
330323
* just do the lookups on every call.
331324
*/
332325
fip = &my_fp;
333326
fetch_fp_info(fid, fip);
334327

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+
335337
/*
336338
* Check permission to access and call function. Since we didn't go
337339
* through a normal name lookup, we need to check schema usage too.
@@ -404,8 +406,8 @@ HandleFunctionRequest(StringInfo msgBuf)
404406
break;
405407
case 2:
406408
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)));
409411
break;
410412
}
411413

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.