Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tUsOz-003UQQ-Q2 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2025 19:04:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tUsOz-00BJkw-71 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2025 19:04:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tUsOy-00BJki-TF for pgsql-hackers@lists.postgresql.org; Mon, 06 Jan 2025 19:04:36 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tUsOv-000CGl-30 for pgsql-hackers@lists.postgresql.org; Mon, 06 Jan 2025 19:04:35 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2163b0c09afso210903605ad.0 for ; Mon, 06 Jan 2025 11:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1736190273; x=1736795073; darn=lists.postgresql.org; h=user-agent: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=yvqVGV+ywbD43kSgvlXuQ1skGtzbSOeFk1vDmNYhZRI=; b=dhVuFLiotzGg2lu3IsZdF50GNh3qrPJ0rPA1tWgs3QVnLoYe7GFYL55jRu+zAQZqpD qaVBQOzFju/CujbEoTVxcsWjohvAtScryuKydpFfF9nvdDIM8ql86Jf2L8TPJHGhOwWH yvdqBCXldCoLnKm3e42cwB1HRpx81mrsJ107U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736190273; x=1736795073; h=user-agent: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=yvqVGV+ywbD43kSgvlXuQ1skGtzbSOeFk1vDmNYhZRI=; b=rHG/nqHT13NFyD2kDanZ/IrpFyvnjDAiQ5oaSiJNdT59iThCHcKbFfb7qCoY8ulQe7 lBGzj46AOiAKh+CKGLlHvkOZrTEP6UglvY4l1H225E/GfWuPlQgd1l7a4lvwbk0X3huk SvwjZIv+b5o9YqpQ4Vn3PXVjc8WJLSusSLmEsyycXZcRKcwrzLkl6fUG9yWdzn17DS61 y/Bot3QDx4E/8/aeN1N4K6oyAg2L7EpvfLnU8D55uKD5UxAkZ0bCcQBrLjDfMuah/Kt3 nSN+UnlkWiJqotzShdmbJqNDocf4f0fI5pa34c0O/WqE5g2kh83W28K1/FCBed2/yeiL bivw== X-Forwarded-Encrypted: i=1; AJvYcCUMWmV60/O1AU/EFVky2qokGn7hNaD0q7FXCisGk4axX4LmOxyRvfa8cC8491p75j8snV4nCru4yJVJNVyp@lists.postgresql.org X-Gm-Message-State: AOJu0YyGTn8DWd8nK23hSsv0PpeyQNqhQUYNlFtoJO/E8yU98SXf6Wh/ 7UVQLbaATAESHXgWWo7u/rdfKnYOj5uKbw3TOu2R/dwn77zCYMbiFLXu2oyjlA== X-Gm-Gg: ASbGncsAASPh3QH8yqQTwTbh/i14ROjOcHLQE3tHXPYTTU491s45nUcfPz3IotljCZl y2Zk/aL0oc7M/pZXvr9CDRTYwDUth1RsDODzlXr4fRfsd9hwCRp2NgCRHnthH9IWYcZw/i+yBjU 8LXT3DxRhn5GgLutndqPwkvcGqVYPadr2BcWnYMWqvryECaKdkaeNln/W4Zc3DC/RcDSYz5/clU Z2iGkjaNtQc2V0meXldJwSQN/uzKLPir9R1l+2/B+cZ0vs8bCg= X-Google-Smtp-Source: AGHT+IH9QIQkDhd2ZoEHXPpo/WTHwahsOQqB8fBMwYv6MXlSsNKPyWSNzWMteCPULzsntPXXeUF+Fw== X-Received: by 2002:a05:6a00:1411:b0:725:f376:f4f4 with SMTP id d2e1a72fcca58-72abde01aa8mr87875247b3a.13.1736190271749; Mon, 06 Jan 2025 11:04:31 -0800 (PST) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fe5fbsm32797357b3a.142.2025.01.06.11.04.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jan 2025 11:04:30 -0800 (PST) Date: Mon, 6 Jan 2025 11:04:28 -0800 From: Noah Misch To: Michael Paquier Cc: Ronan Dunklau , Tom Lane , pgsql-hackers@lists.postgresql.org, Peter Eisentraut Subject: Re: Converting contrib SQL functions to new style Message-ID: <20250106190428.ec.nmisch@google.com> References: <3395418.1618352794@sss.pgh.pa.us> <3133933.1730855116@sss.pgh.pa.us> <5829980.DvuYhMxLoT@aivenlaptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 12, 2024 at 05:30:30PM +0900, Michael Paquier wrote: > 0004 for pg_freespace is fine regarding that for example as we have > calls of pg_freespace(regclass) in its sql/. I've applied it to begin > with something. That commit (3f323eb) contains a generate_series(int, bigint) call. Following https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATTERNS is enough in v17, but it wouldn't be enough after that commit. An attacker can achieve persistent capture of the inexact call: set search_path = pg_catalog; create or replace function public.generate_series(int, bigint) returns bigint language plpgsql as $$ BEGIN RAISE NOTICE 'owned'; RETURN 0; END $$; create extension pg_freespacemap schema public; select public.pg_freespace(0); \sf public.pg_freespace(regclass) Per postgr.es/m/3489827.1618411777@sss.pgh.pa.us and postgr.es/m/1471865.1734212070@sss.pgh.pa.us one requirement for migrating to SQL-standard function bodies is removing these inexact-match function and operator calls. Here, one could either write pg_catalog.generate_series or make the argument types match exactly.