@@ -298,7 +298,10 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
298
298
PQExpBufferData buf ;
299
299
PGresult * res ;
300
300
printQueryOpt myopt = pset .popt ;
301
- static const bool translate_columns [] = {false, false, false, false, true, true, true, false, false, false, false};
301
+ static const bool translate_columns [] = {false, false, false, false, true, true, true, false, true, false, false, false, false};
302
+
303
+ /* No "Parallel" column before 9.6 */
304
+ static const bool translate_columns_pre_96 [] = {false, false, false, false, true, true, false, true, false, false, false, false};
302
305
303
306
if (strlen (functypes ) != strspn (functypes , "antwS+" ))
304
307
{
@@ -410,28 +413,45 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
410
413
gettext_noop ("Type" ));
411
414
412
415
if (verbose )
416
+ {
413
417
appendPQExpBuffer (& buf ,
414
- ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\""
415
418
",\n CASE\n"
416
419
" WHEN p.provolatile = 'i' THEN '%s'\n"
417
420
" WHEN p.provolatile = 's' THEN '%s'\n"
418
421
" WHEN p.provolatile = 'v' THEN '%s'\n"
419
- " END as \"%s\""
420
- ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\",\n"
421
- " l.lanname as \"%s\",\n"
422
- " p.prosrc as \"%s\",\n"
423
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"" ,
424
- gettext_noop ("definer" ),
425
- gettext_noop ("invoker" ),
426
- gettext_noop ("Security" ),
422
+ " END as \"%s\"" ,
427
423
gettext_noop ("immutable" ),
428
424
gettext_noop ("stable" ),
429
425
gettext_noop ("volatile" ),
430
- gettext_noop ("Volatility" ),
426
+ gettext_noop ("Volatility" ));
427
+ if (pset .sversion >= 90600 )
428
+ appendPQExpBuffer (& buf ,
429
+ ",\n CASE\n"
430
+ " WHEN p.proparallel = 'r' THEN '%s'\n"
431
+ " WHEN p.proparallel = 's' THEN '%s'\n"
432
+ " WHEN p.proparallel = 'u' THEN '%s'\n"
433
+ " END as \"%s\"" ,
434
+ gettext_noop ("restricted" ),
435
+ gettext_noop ("safe" ),
436
+ gettext_noop ("unsafe" ),
437
+ gettext_noop ("Parallel" ));
438
+ appendPQExpBuffer (& buf ,
439
+ ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\""
440
+ ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\"" ,
431
441
gettext_noop ("Owner" ),
442
+ gettext_noop ("definer" ),
443
+ gettext_noop ("invoker" ),
444
+ gettext_noop ("Security" ));
445
+ appendPQExpBufferStr (& buf , ",\n " );
446
+ printACLColumn (& buf , "p.proacl" );
447
+ appendPQExpBuffer (& buf ,
448
+ ",\n l.lanname as \"%s\""
449
+ ",\n p.prosrc as \"%s\""
450
+ ",\n pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"" ,
432
451
gettext_noop ("Language" ),
433
452
gettext_noop ("Source code" ),
434
453
gettext_noop ("Description" ));
454
+ }
435
455
436
456
appendPQExpBufferStr (& buf ,
437
457
"\nFROM pg_catalog.pg_proc p"
@@ -530,8 +550,16 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
530
550
myopt .nullPrint = NULL ;
531
551
myopt .title = _ ("List of functions" );
532
552
myopt .translate_header = true;
533
- myopt .translate_columns = translate_columns ;
534
- myopt .n_translate_columns = lengthof (translate_columns );
553
+ if (pset .sversion >= 90600 )
554
+ {
555
+ myopt .translate_columns = translate_columns ;
556
+ myopt .n_translate_columns = lengthof (translate_columns );
557
+ }
558
+ else
559
+ {
560
+ myopt .translate_columns = translate_columns_pre_96 ;
561
+ myopt .n_translate_columns = lengthof (translate_columns_pre_96 );
562
+ }
535
563
536
564
printQuery (res , & myopt , pset .queryFout , false, pset .logfile );
537
565
0 commit comments