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 1qQxQh-0005PL-43 for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Aug 2023 22:01:23 +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 1qQxPh-000YpA-AW for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Aug 2023 22:00:21 +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 1qQxPh-000Yok-1T for pgsql-hackers@lists.postgresql.org; Tue, 01 Aug 2023 22:00:21 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qQxPe-00017w-Sw for pgsql-hackers@postgresql.org; Tue, 01 Aug 2023 22:00:20 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-267fc04ec74so4496716a91.0 for ; Tue, 01 Aug 2023 15:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20221208.gappssmtp.com; s=20221208; t=1690927218; x=1691532018; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=xZ9DqBu0/Ia4S3YuJcl+eysrSEFLdp3kHfhF+AFzT4w=; b=dhTYPXxaQVgR1870UqZIsxMpAVEgh6+455/F6SZh7ndiujva5rHGMRG7tzM/lNjmVb Crz7i9Wbn4mwT8oLYMl8gNToOYJNVtSwKC3R8h7fBekrT9tnN2c2xT3hdWpKY3/epZgn xoX+hRQpbMgtT1Y6Vy+AOVu0eRnhuenHNBV0Nfs/BbKWNGpw3raUcuSRVUAZmhCK7GFg avTErujLNvyi39O2mmASKxRqJs9jGB4EeOGJLG4b1+SKpIIVHrxI9eNg3642H3VNSXRR gUmPG/RtWwCHr4BvELMD5YdA4LH3VYrMhWN416as6Bd/8+5mmnVhkPxkfL7nQ1Ttb7Ug hFAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690927218; x=1691532018; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xZ9DqBu0/Ia4S3YuJcl+eysrSEFLdp3kHfhF+AFzT4w=; b=Ogrj08xmF5f8xxhqjQ3d/zIihqIPHkzGusybGLIj4NXiZuy+altOlOomVLcjslwuBp 0OjcRXiBIn5VOr1EJboruOf9XdDYjij6EPRhHU1fdnLUO7uJKWelmkogcUNc1xsnIigy gFV1URDqBoHV4FwqD9RVdsJz9u9yeXy2Joia3zTk1874B0gBfXDU/dhWAC1Bun5MCmHT Chx5LWWyTMiyHa3pv7TIS4PPeleHl+F30pqubd96I42eQAky8JxKLnMYjpGBzs7hzq1P OkVSldWK0+Ju7B6NK7gjNrMsQWRbhK7UpvcwSFfX7qv1g1MqQCOsWrMr89nUwQy7bGXB zVLA== X-Gm-Message-State: ABy/qLbRM2cf3zlM2LWZ3JYwSp4NC7unkCBMz3RHY8bSTbow9Eoy/Ea+ 9re3qhX5vkMJPvuyBab8m4fDNQ== X-Google-Smtp-Source: APBJJlH3ahmeU9gi5daYKpe4pEgpM2jeC80LhZUy7AmJnU+NANFTyp/Fi1JGhOcvRJJ5X8wyFqM0jQ== X-Received: by 2002:a17:90a:8986:b0:268:b7a2:62f1 with SMTP id v6-20020a17090a898600b00268b7a262f1mr7381256pjn.27.1690927217897; Tue, 01 Aug 2023 15:00:17 -0700 (PDT) Received: from [172.18.10.30] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a3b4a00b002676e961260sm1512017pjf.0.2023.08.01.15.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 15:00:17 -0700 (PDT) Message-ID: <719aefb79d03f6b871aa05812d4547a08691c25f.camel@j-davis.com> Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations. From: Jeff Davis To: Robert Haas Cc: Tom Lane , Noah Misch , "pgsql-hackers@postgresql.org" , Nathan Bossart Date: Tue, 01 Aug 2023 15:00:16 -0700 In-Reply-To: References: <89a415b86d5421941e4281ba5bf6288934078624.camel@j-davis.com> <573014.1686375211@sss.pgh.pa.us> <20230612170510.GA201972@gust.leadboat.com> <20230613182920.GA259321@gust.leadboat.com> <1799839.1686687804@sss.pgh.pa.us> <4df537f5a0d8c0ceac3eec3809d1144880b8e76d.camel@j-davis.com> <578fb4be80247570e6a05924908765a0b345971e.camel@j-davis.com> <43bbc9f7318057f51552d5986830908cb018dadf.camel@j-davis.com> <1659699.1688086436@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2023-08-01 at 13:41 -0400, Robert Haas wrote: > In functions and procedures, except for the new > BEGIN ATOMIC stuff, we just store the statements as a string and they > get parsed at execution time. ... > I think that a lot of people would like it if we moved more in the > direction of parsing statements at object definition time. Do you mean that we'd introduce some BEGIN ATOMIC version of plpgsql (and other trusted languages)? > However, there are some > fairly significant problems with that idea. To satisfy intended use cases of things like default expressions, CHECK constraints, index expressions, etc., there is no need to call functions that would be subject to the problems you list. One problem is that functions are too general a concept -- we have no idea whether the user is trying to do something simple or trying to do something "interesting". > Now, if we don't go in the direction of resolving everything at parse > time, It would be useful to pursue this approach, but I don't think it will be enough. We still need to solve our search_path problems. > then I think capturing search_path is probably the next best > thing, +0.5. > To be honest, I think it's > a > bit of a kludge, and dropping a kludge on top of our entire user base > and maybe also breaking a lot of things is not particularly where I > want to be. I just don't have an idea I like better at the moment. We will also be fixing things for a lot of users who just haven't run into a problem *yet* (or perhaps did, and just don't know it). Regards, Jeff Davis