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 1lYCaN-0000UZ-Hd for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Apr 2021 18:55:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lYCaL-0007ZQ-Cd for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Apr 2021 18:55:57 +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 1lYCaK-0007Xh-Tj for pgsql-hackers@lists.postgresql.org; Sun, 18 Apr 2021 18:55:57 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lYCaF-0003CW-Bx for pgsql-hackers@postgresql.org; Sun, 18 Apr 2021 18:55:55 +0000 Received: by mail-pf1-x430.google.com with SMTP id w8so18249484pfn.9 for ; Sun, 18 Apr 2021 11:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dXfuulv7PrQDIayjznTiIwt0EFADORpJqrSi1GJfE7Q=; b=Vhx9BR7KZdHYtcIen1DB/eqojaADYcuqp/A/ayvFwf9qsuyzOqxfNbiZcXrcqio/xc CxvzQkBVCrpByktjY9BXOJXtYM7W8HV1V6gcOLTipW7xKEZYY1jcOj2KgPSmFbuuwU49 KoZvGyrKwYjSuvovWc5ZDShcdLBsQ4SwfAUsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dXfuulv7PrQDIayjznTiIwt0EFADORpJqrSi1GJfE7Q=; b=tbm0tmkACS17W+FO+gXCe3aVK0fvIisMHjAhEm5L6KZpVq4215TIG8pFrr1vN5D+W9 /piLBV2BWEDG9kwlhVDCPDbACV9MOnas77BYAXRPYDEOMwPaiyfB2S/ORdIWqBjr8C94 XbumpQ84TnXmJZQ3I87N6jfOXuJ0aI2ZNg8tRBDTIjH9L/l7KZlmWjugMTNKMjoRGnyT LaqPZWiuNkQcr/p77HWx3J2rm4RY+jbgukT7hClZZr2A2C0t+BrsbfA7fEpZe09vaEBh UQAOWBV9DKFzo5FdJRglZfwyzcKV3t5maz/AskWiDv/S+f+SaMpR/3WRrZLwUKBhPn7X BnHg== X-Gm-Message-State: AOAM531tZtFk7LmALLRTrA4u0lnGhPP9R+ArZmypdETxJs7Wq8LSI+7m FH6ntmsxFEeaIW2LbSPVJ6foPA== X-Google-Smtp-Source: ABdhPJx0DJzl9NmT9Ap2ftoBvxIOj/2rp7JTGlbVKbmwNQITWcU4YbTdKOBJHg2PX3IBuwknvjA7sg== X-Received: by 2002:a63:231c:: with SMTP id j28mr8356976pgj.165.1618772150195; Sun, 18 Apr 2021 11:55:50 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id b136sm10706596pfb.126.2021.04.18.11.55.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Apr 2021 11:55:49 -0700 (PDT) Date: Sun, 18 Apr 2021 11:55:46 -0700 From: Noah Misch To: Peter Eisentraut , Tom Lane Cc: Robert Haas , pgsql-hackers Subject: Re: SQL-standard function body Message-ID: <20210418185546.GC1500781@rfd.leadboat.com> References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com> <493812.1593541480@sss.pgh.pa.us> <494838.1593543098@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <494838.1593543098@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 30, 2020 at 02:51:38PM -0400, Tom Lane wrote: > The point remains that exposing the function body's dependencies will > constrain restore order far more than we are accustomed to see. It > might be possible to build examples that flat out can't be restored, > even granting that we teach pg_dump how to break dependency loops > by first creating the function with empty body and later redefining > it with the real body. (Admittedly, if that's possible then you > likely could make it happen with views too. But somehow it seems > more likely that people would create spaghetti dependencies for > functions than views.) Should we be okay releasing v14 without support for breaking function dependency loops, or does that call for an open item? -- example create function f() returns int language sql return 1; create function g() returns int language sql return f(); create or replace function f() returns int language sql return coalesce(2, g()); -- but when a view can break the cycle, pg_dump still does so create view v as select 1 as c; create function f() returns int language sql return coalesce(0, (select count(*) from v)); create or replace view v as select f() as c;