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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Yushu Chen <gentcys(at)gmail(dot)com>, katja(dot)henke(at)foo(dot)ag, PostgreSQL Bug List <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own
Date: 2025-09-07 22:50:47
Message-ID: CAKFQuwaFZzT3XCQiyX47Q6sP735CHBxONF6NWzB=0ikssf=3pQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Sep 7, 2025, 15:37 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Right, because the oid is preserved when the create or replace finishes
> > pg_depend must have an entry where objid = refobjid where the oid value
> is
> > that of the originally created function that is now just being altered.
> > That situation seems detectable and prohibit-able.
>
> This would not fix the problem for the case of two or more mutually
> recursive functions (that is, a() calls b() calls a()). So I don't
> find it to be an attractive answer.
>

Tack on a modified implementation of the existing detection of circular
dependencies among roles to detect circular dependencies among sql_body
functions?

While I agree making it must work would be nice given the presence of
simple alternatives to use when this functionality is required it's got to
be easier to detect and prohibit creation.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kristo Marijo 2025-09-08 06:39:47 AW: BUG #19043: jdbc connection url is not case insensitive
Previous Message Tom Lane 2025-09-07 22:36:56 Re: BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own