pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wicher <wicher+pglist@gavagai.nl>
To: Shaozhong SHI <shishaozhong@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: How to reveal the codes of functions properly?
Date: Tue, 30 Nov 2021 21:39:09 +0100
Message-ID: <20211130213909.1dcd61ab@tipi> (raw)
In-Reply-To: <CA+i5JwaFb46T8Ss5d06irOWjuyyYWX8tzarT=gK7G5sEq51Dag@mail.gmail.com>
References: <CA+i5JwYx5PVnfiLBnFGh4n0woe3CkKbuFC8yjeY3Naf8hLU-zw@mail.gmail.com>
	<5289b70b-9733-b59c-bae4-bbd47f7285a8@gmail.com>
	<CA+i5JwaFb46T8Ss5d06irOWjuyyYWX8tzarT=gK7G5sEq51Dag@mail.gmail.com>

On Tue, 30 Nov 2021 20:17:32 +0000
Shaozhong SHI <shishaozhong@gmail.com> wrote:

> In what environment, that did not work.
> 
> 
> On Tuesday, 30 November 2021, Rob Sargent <robjsargent@gmail.com> wrote:
> 
> > On 11/30/21 9:30 AM, Shaozhong SHI wrote:
> >
> > Any one can shed the light on this?
> >
> > Regards,
> >
> > David
> >
> > \sf+ function_name
> >  

If you run that in a psql shell when psql has been passed `-E`, you'll see that under the
hood it runs:

SELECT n.nspname as "Schema",
  p.proname as "Name",
  pg_catalog.pg_get_function_result(p.oid) as "Result data type",
  pg_catalog.pg_get_function_arguments(p.oid) as "Argument data types",
 CASE p.prokind
  WHEN 'a' THEN 'agg'
  WHEN 'w' THEN 'window'
  WHEN 'p' THEN 'proc'
  ELSE 'func'
 END as "Type",
 CASE
  WHEN p.provolatile = 'i' THEN 'immutable'
  WHEN p.provolatile = 's' THEN 'stable'
  WHEN p.provolatile = 'v' THEN 'volatile'
 END as "Volatility",
 CASE
  WHEN p.proparallel = 'r' THEN 'restricted'
  WHEN p.proparallel = 's' THEN 'safe'
  WHEN p.proparallel = 'u' THEN 'unsafe'
 END as "Parallel",
 pg_catalog.pg_get_userbyid(p.proowner) as "Owner",
 CASE WHEN prosecdef THEN 'definer' ELSE 'invoker' END AS "Security",
 pg_catalog.array_to_string(p.proacl, E'\n') AS "Access privileges",
 l.lanname as "Language",
 p.prosrc as "Source code",
 pg_catalog.obj_description(p.oid, 'pg_proc') as "Description"
FROM pg_catalog.pg_proc p
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
     LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang
WHERE pg_catalog.pg_function_is_visible(p.oid)
      AND n.nspname <> 'pg_catalog'
      AND n.nspname <> 'information_schema'
ORDER BY 1, 2, 4;





view thread (6+ messages)  latest in thread

Message-ID: <20211130213909.1dcd61ab@tipi>
Permalink:  ../20211130213909.1dcd61ab@tipi/
Also on:    postgresql.org/message-id/20211130213909.1dcd61ab@tipi

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: wicher+pglist@gavagai.nl, shishaozhong@gmail.com
  Subject: Re: How to reveal the codes of functions properly?
  In-Reply-To: <20211130213909.1dcd61ab@tipi>
  References: <CA+i5JwYx5PVnfiLBnFGh4n0woe3CkKbuFC8yjeY3Naf8hLU-zw@mail.gmail.com> <5289b70b-9733-b59c-bae4-bbd47f7285a8@gmail.com> <CA+i5JwaFb46T8Ss5d06irOWjuyyYWX8tzarT=gK7G5sEq51Dag@mail.gmail.com> <20211130213909.1dcd61ab@tipi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox