Skip to content

Commit 1b84441

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

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/backend/tcop/fastpath.c

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy