@@ -312,6 +312,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
312
312
{
313
313
bool showAggregate = strchr (functypes , 'a' ) != NULL ;
314
314
bool showNormal = strchr (functypes , 'n' ) != NULL ;
315
+ bool showProcedure = strchr (functypes , 'p' ) != NULL ;
315
316
bool showTrigger = strchr (functypes , 't' ) != NULL ;
316
317
bool showWindow = strchr (functypes , 'w' ) != NULL ;
317
318
bool have_where ;
@@ -323,25 +324,39 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
323
324
/* No "Parallel" column before 9.6 */
324
325
static const bool translate_columns_pre_96 [] = {false, false, false, false, true, true, false, true, false, false, false, false};
325
326
326
- if (strlen (functypes ) != strspn (functypes , "antwS +" ))
327
+ if (strlen (functypes ) != strspn (functypes , "anptwS +" ))
327
328
{
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 )));
329
341
return true;
330
342
}
331
343
332
344
if (showWindow && pset .sversion < 80400 )
333
345
{
334
346
char sverbuf [32 ];
335
347
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' ,
337
350
formatPGVersionNumber (pset .sversion , false,
338
351
sverbuf , sizeof (sverbuf )));
339
352
return true;
340
353
}
341
354
342
- if (!showAggregate && !showNormal && !showTrigger && !showWindow )
355
+ if (!showAggregate && !showNormal && !showProcedure && ! showTrigger && !showWindow )
343
356
{
344
357
showAggregate = showNormal = showTrigger = true;
358
+ if (pset .sversion >= 110000 )
359
+ showProcedure = true;
345
360
if (pset .sversion >= 80400 )
346
361
showWindow = true;
347
362
}
@@ -505,7 +520,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
505
520
have_where = false;
506
521
507
522
/* filter by function type, if requested */
508
- if (showNormal && showAggregate && showTrigger && showWindow )
523
+ if (showNormal && showAggregate && showProcedure && showTrigger && showWindow )
509
524
/* Do nothing */ ;
510
525
else if (showNormal )
511
526
{
@@ -523,6 +538,17 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
523
538
else
524
539
appendPQExpBufferStr (& buf , "NOT p.proisagg\n" );
525
540
}
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
+ }
526
552
if (!showTrigger )
527
553
{
528
554
if (have_where )
@@ -572,6 +598,13 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
572
598
"p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n" );
573
599
needs_or = true;
574
600
}
601
+ if (showProcedure )
602
+ {
603
+ if (needs_or )
604
+ appendPQExpBufferStr (& buf , " OR " );
605
+ appendPQExpBufferStr (& buf , "p.prokind = 'p'\n" );
606
+ needs_or = true;
607
+ }
575
608
if (showWindow )
576
609
{
577
610
if (needs_or )
0 commit comments