Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ms9uJ-0001GW-Lt for pgsql-general@arkaria.postgresql.org; Tue, 30 Nov 2021 20:39:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ms9uI-0006z2-Ft for pgsql-general@arkaria.postgresql.org; Tue, 30 Nov 2021 20:39:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ms9uI-0006xD-5U for pgsql-general@lists.postgresql.org; Tue, 30 Nov 2021 20:39:18 +0000 Received: from mail.gavagai.nl ([5.135.160.52]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ms9uF-0001ud-Bs for pgsql-general@lists.postgresql.org; Tue, 30 Nov 2021 20:39:17 +0000 Received: from tipi (ns3002999.ip-151-80-42.eu [151.80.42.145]) by mail.gavagai.nl (MAIL-O-TRON) with ESMTPSA id 6E8DBDFCB5C; Tue, 30 Nov 2021 21:39:12 +0100 (CET) Date: Tue, 30 Nov 2021 21:39:09 +0100 From: Wicher To: Shaozhong SHI Cc: "pgsql-general@lists.postgresql.org" Subject: Re: How to reveal the codes of functions properly? Message-ID: <20211130213909.1dcd61ab@tipi> In-Reply-To: References: <5289b70b-9733-b59c-bae4-bbd47f7285a8@gmail.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 30 Nov 2021 20:17:32 +0000 Shaozhong SHI wrote: > In what environment, that did not work. > > > On Tuesday, 30 November 2021, Rob Sargent 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;