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 1pPe2G-0003tO-FW for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2023 06:34:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPe1F-0004DY-Gz for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2023 06:33:25 +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 1pPe1F-0004DP-1P for pgsql-hackers@lists.postgresql.org; Wed, 08 Feb 2023 06:33:25 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pPe1B-0002Vp-Iy for pgsql-hackers@lists.postgresql.org; Wed, 08 Feb 2023 06:33:23 +0000 Received: by mail-pl1-x631.google.com with SMTP id m2so18230579plg.4 for ; Tue, 07 Feb 2023 22:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YvkO0Q+mihzMyYd2Ykqs6takVgVS43ZjGKABrXzlUYE=; b=KGLHMY3IcRwnofJgXhzU+JL3kM3XP1YWPLoP8eGLRQVtGdkjRmthWkAmVRvos4GRB+ UaoDL5XJXAXvN/803JN6Te1GtbaXC3VjVHOpUb2zb0DaAEzVoo5JSFrTA72PEXm8q7eL DPilVQbGNX4pX5Vx9N97y7niRF0sWTAnOTnfyuJ76h/vU7h9aOFPTftXDoTpgcDOvtym jqcLnmsCpuLBlhBdD9eoUF41bZORYoE8CNfbatUiT7NW/wtqW8iHjg6aDopPTOzPucYI BTPW2dQpNtm5J4LCoHaN70OyePIESI44ggSIk9xbjA8UNgg7+IwsJr/wV/E9dya/oWPm smXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YvkO0Q+mihzMyYd2Ykqs6takVgVS43ZjGKABrXzlUYE=; b=ue7EWnYOQWYwO/yXeRsF7SQEsrZ4Xe9reMA7+OU9GbDoST+3xhgIBStfNPQEvz6d3a O2apYNsRQL1C6wE3jMnhxoetx8CGb0ax23QDlN2SRYvbqpq6aWh6F6xdbdeTsw++XqyQ d+ObT/AW2U3lk/Xw5y+UHivqnDn4fuwYADXgFBYbdXlVh6nLznoxpRVPZAqBvPHEUqEH JUo6SkutGAgNLUYFuQEY1RNpp2aQ5cTdr4AzWpRhMy1XYuBDSlfza7z190Tf3IX1R2yZ SGrXA7jvf1WJcH1IEODCBwCDFoaAFwDcOjmviwCuwzUMyAlnk44qwI9Z1Y8Ly1+MwRPk Y8dg== X-Gm-Message-State: AO0yUKXWEfSUR3CsI2UAAdj3MJ6og+nPaPrlV9BR4D4CmbfPMTjgFJZi 6lqoF6gmnEbw+j0gahlg4Ng= X-Google-Smtp-Source: AK7set9VhI/YqYakyJXrgsEhtcgLsfD4NhZUSYhrQjZQIeEDK6Y7g4UuHu2Icvp20gtpeea1syqv+Q== X-Received: by 2002:a17:90b:1b4b:b0:22b:e590:68d0 with SMTP id nv11-20020a17090b1b4b00b0022be59068d0mr7186852pjb.49.1675838000210; Tue, 07 Feb 2023 22:33:20 -0800 (PST) Received: from jrouhaud (2001-b011-1006-db52-aceb-6d8d-f2f9-cf64.dynamic-ip6.hinet.net. [2001:b011:1006:db52:aceb:6d8d:f2f9:cf64]) by smtp.gmail.com with ESMTPSA id t23-20020a639557000000b004ecd14297f2sm8936519pgn.10.2023.02.07.22.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 22:33:19 -0800 (PST) Date: Wed, 8 Feb 2023 14:33:16 +0800 From: Julien Rouhaud To: Pavel Stehule Cc: PostgreSQL Hackers Subject: Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID Message-ID: <20230208063316.atjv6uxb7owm77s6@jrouhaud> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Feb 07, 2023 at 08:48:22PM +0100, Pavel Stehule wrote: > > I have a question about the possibility of simply getting the name of the > currently executed function. The reason for this request is simplification > of writing debug messages. > > GET DIAGNOSTICS _oid = PG_ROUTINE_OID; > RAISE NOTICE '... % ... %', _oid, _oid::regproc::text; > > The advantage of this dynamic access to function name is always valid value > not sensitive to some renaming or moving between schemas. > > I am able to separate a name from context, but it can be harder to write > this separation really robustly. It can be very easy to enhance the GET > DIAGNOSTICS statement to return the oid of currently executed function. > > Do you think it can be useful feature? +1, it would have been quite handy in a few of my projects.