pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to reveal the codes of functions properly?
6+ messages / 4 participants
[nested] [flat]

* How to reveal the codes of functions properly?
@ 2021-11-30 16:30 Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 16:33 ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Shaozhong SHI @ 2021-11-30 16:30 UTC (permalink / raw)
  To: pgsql-general <pgsql-general@lists.postgresql.org>

Any one can shed the light on this?

Regards,

David

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to reveal the codes of functions properly?
  2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
@ 2021-11-30 16:33 ` Rob Sargent <robjsargent@gmail.com>
  2021-11-30 20:17   ` Re: How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Rob Sargent @ 2021-11-30 16:33 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 11/30/21 9:30 AM, Shaozhong SHI wrote:
> Any one can shed the light on this?
>
> Regards,
>
> David
\sf+ function_name

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to reveal the codes of functions properly?
  2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 16:33 ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
@ 2021-11-30 20:17   ` Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 20:17     ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
  2021-11-30 20:39     ` Re: How to reveal the codes of functions properly? Wicher <wicher+pglist@gavagai.nl>
  2021-11-30 22:53     ` Re: How to reveal the codes of functions properly? David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 3 replies; 6+ messages in thread

From: Shaozhong SHI @ 2021-11-30 20:17 UTC (permalink / raw)
  To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to reveal the codes of functions properly?
  2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 16:33 ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
  2021-11-30 20:17   ` Re: How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
@ 2021-11-30 20:17     ` Rob Sargent <robjsargent@gmail.com>
  2 siblings, 0 replies; 6+ messages in thread

From: Rob Sargent @ 2021-11-30 20:17 UTC (permalink / raw)
  To: Shaozhong SHI <shishaozhong@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On 11/30/21 1:17 PM, Shaozhong SHI wrote:
> In what environment, that did not work.
>
>
> On Tuesday, 30 November 2021, Rob Sargent <robjsargent@gmail.com 
> <mailto: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
>
psql

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to reveal the codes of functions properly?
  2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 16:33 ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
  2021-11-30 20:17   ` Re: How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
@ 2021-11-30 20:39     ` Wicher <wicher+pglist@gavagai.nl>
  2 siblings, 0 replies; 6+ messages in thread

From: Wicher @ 2021-11-30 20:39 UTC (permalink / raw)
  To: Shaozhong SHI <shishaozhong@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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;





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to reveal the codes of functions properly?
  2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
  2021-11-30 16:33 ` Re: How to reveal the codes of functions properly? Rob Sargent <robjsargent@gmail.com>
  2021-11-30 20:17   ` Re: How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
@ 2021-11-30 22:53     ` David G. Johnston <david.g.johnston@gmail.com>
  2 siblings, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2021-11-30 22:53 UTC (permalink / raw)
  To: Shaozhong SHI <shishaozhong@gmail.com>; +Cc: Rob Sargent <robjsargent@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Nov 30, 2021 at 1:17 PM Shaozhong SHI <shishaozhong@gmail.com>
wrote:

> In what environment, that did not work.
>
>>
>>
In what environment did you wish the answer to be given?

David J.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2021-11-30 22:53 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 16:30 How to reveal the codes of functions properly? Shaozhong SHI <shishaozhong@gmail.com>
2021-11-30 16:33 ` Rob Sargent <robjsargent@gmail.com>
2021-11-30 20:17   ` Shaozhong SHI <shishaozhong@gmail.com>
2021-11-30 20:17     ` Rob Sargent <robjsargent@gmail.com>
2021-11-30 20:39     ` Wicher <wicher+pglist@gavagai.nl>
2021-11-30 22:53     ` David G. Johnston <david.g.johnston@gmail.com>

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