@@ -312,6 +312,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
312312{
313313 bool showAggregate = strchr (functypes , 'a' ) != NULL ;
314314 bool showNormal = strchr (functypes , 'n' ) != NULL ;
315+ bool showProcedure = strchr (functypes , 'p' ) != NULL ;
315316 bool showTrigger = strchr (functypes , 't' ) != NULL ;
316317 bool showWindow = strchr (functypes , 'w' ) != NULL ;
317318 bool have_where ;
@@ -323,25 +324,39 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
323324 /* No "Parallel" column before 9.6 */
324325 static const bool translate_columns_pre_96 [] = {false, false, false, false, true, true, false, true, false, false, false, false};
325326
326- if (strlen (functypes ) != strspn (functypes , "antwS +" ))
327+ if (strlen (functypes ) != strspn (functypes , "anptwS +" ))
327328 {
328- psql_error ("\\df only takes [antwS+] as options\n" );
329+ psql_error ("\\df only takes [anptwS+] as options\n" );
330+ return true;
331+ }
332+
333+ if (showProcedure && pset .sversion < 110000 )
334+ {
335+ char sverbuf [32 ];
336+
337+ psql_error ("\\df does not take a \"%c\" option with server version %s\n" ,
338+ 'p' ,
339+ formatPGVersionNumber (pset .sversion , false,
340+ sverbuf , sizeof (sverbuf )));
329341 return true;
330342 }
331343
332344 if (showWindow && pset .sversion < 80400 )
333345 {
334346 char sverbuf [32 ];
335347
336- psql_error ("\\df does not take a \"w\" option with server version %s\n" ,
348+ psql_error ("\\df does not take a \"%c\" option with server version %s\n" ,
349+ 'w' ,
337350 formatPGVersionNumber (pset .sversion , false,
338351 sverbuf , sizeof (sverbuf )));
339352 return true;
340353 }
341354
342- if (!showAggregate && !showNormal && !showTrigger && !showWindow )
355+ if (!showAggregate && !showNormal && !showProcedure && ! showTrigger && !showWindow )
343356 {
344357 showAggregate = showNormal = showTrigger = true;
358+ if (pset .sversion >= 110000 )
359+ showProcedure = true;
345360 if (pset .sversion >= 80400 )
346361 showWindow = true;
347362 }
@@ -505,7 +520,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
505520 have_where = false;
506521
507522 /* filter by function type, if requested */
508- if (showNormal && showAggregate && showTrigger && showWindow )
523+ if (showNormal && showAggregate && showProcedure && showTrigger && showWindow )
509524 /* Do nothing */ ;
510525 else if (showNormal )
511526 {
@@ -523,6 +538,17 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
523538 else
524539 appendPQExpBufferStr (& buf , "NOT p.proisagg\n" );
525540 }
541+ if (!showProcedure && pset .sversion >= 110000 )
542+ {
543+ if (have_where )
544+ appendPQExpBufferStr (& buf , " AND " );
545+ else
546+ {
547+ appendPQExpBufferStr (& buf , "WHERE " );
548+ have_where = true;
549+ }
550+ appendPQExpBufferStr (& buf , "p.prokind <> 'p'\n" );
551+ }
526552 if (!showTrigger )
527553 {
528554 if (have_where )
@@ -572,6 +598,13 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
572598 "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n" );
573599 needs_or = true;
574600 }
601+ if (showProcedure )
602+ {
603+ if (needs_or )
604+ appendPQExpBufferStr (& buf , " OR " );
605+ appendPQExpBufferStr (& buf , "p.prokind = 'p'\n" );
606+ needs_or = true;
607+ }
575608 if (showWindow )
576609 {
577610 if (needs_or )
0 commit comments