Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own
Date
Msg-id CAKFQuwYfD-JE8svtfJcgCHce=8ag5000Gms4hr=JXH+L8CWhPQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-bugs
On Friday, September 5, 2025, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
On Thu, 2025-09-04 at 11:24 -0400, Tom Lane wrote:
> Given that recursive SQL functions are a tiny-minority use case
> and there's already a perfectly serviceable way to make them
> (ie use an old-style body), I seriously doubt that we'll do
> anything about this request.

Sure, but creating a dump that will fail to load is not good.
I don't have a smarter idea that dumping standard SQL functions
in two statements like you suggested...

When resolving the dependency graph for such a function can we prevent the oid of the parent and the oid of the child being the same value?  Prohibit direct self-references so it fails even if you use “or replace”.

David J. 

pgsql-bugs by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own
Next
From: Tom Lane
Date:
Subject: Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own