pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18081: Spurious "function with OID ###### does not exist" error
3+ messages / 3 participants
[nested] [flat]

* BUG #18081: Spurious "function with OID ###### does not exist" error
@ 2023-09-04 09:12 PG Bug reporting form <noreply@postgresql.org>
  2023-09-04 15:30 ` Re: BUG #18081: Spurious "function with OID ###### does not exist" error Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2023-09-04 09:12 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: branko.radovanovic.zg@gmail.com

The following bug has been logged on the website:

Bug reference:      18081
Logged by:          Branko Radovanovic
Email address:      branko.radovanovic.zg@gmail.com
PostgreSQL version: 13.5
Operating system:   Debian 8.3.0
Description:        

When executing the following sequence of statements:

		CREATE OR REPLACE PROCEDURE proc(param text default 'n/a')
			LANGUAGE plpgsql
		AS $procedure$
			BEGIN
				raise info 'proc(%)', param;
			END;
		$procedure$;

		CREATE OR REPLACE PROCEDURE test1()
			LANGUAGE plpgsql
		AS $procedure$
			BEGIN
				call proc();
			END;
		$procedure$;

		CREATE OR REPLACE PROCEDURE proc()
			LANGUAGE plpgsql
		AS $procedure$
			BEGIN
				raise info 'proc()';
			END;
		$procedure$;

		DROP PROCEDURE proc(text);

		CREATE OR REPLACE PROCEDURE test2()
			LANGUAGE plpgsql
		AS $procedure$
			BEGIN
				call proc();
			END;
		$procedure$;

		call test2(); --#A
		call test1(); --#B

...statement #A will output:

		proc()

...which is as expected, while statement #B will throw an error:

		SQL Error [42883]: ERROR: function with OID 102048 does not exist
		  Where: SQL statement "CALL proc()"
		PL/pgSQL function test1() line 3 at CALL
		
I get this behavior in versions 13.5 and 14.9. This is strange because it
would imply that:
1) It is possible to have two procedures with identical bodies, one of which
works while the other does not
2) The way a procedure behaves is dependent on the state of the database in
the instant the procedure was created

Both of these conclusions break the mental model of plpgsql as being fully
interpreted. On top of that, this sort of situation cannot be detected by
parsing tools such as plpgsql_check nor by human review, as nothing is wrong
with the code itself. I would argue that #B should work exactly the same as
#A.

Best regards,
Branko Radovanovic



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18081: Spurious "function with OID ###### does not exist" error
  2023-09-04 09:12 BUG #18081: Spurious "function with OID ###### does not exist" error PG Bug reporting form <noreply@postgresql.org>
@ 2023-09-04 15:30 ` Tom Lane <tgl@sss.pgh.pa.us>
  2023-09-05 11:57   ` Re: BUG #18081: Spurious "function with OID ###### does not exist" error Branko Radovanovic <branko.radovanovic.zg@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2023-09-04 15:30 UTC (permalink / raw)
  To: branko.radovanovic.zg@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> PostgreSQL version: 13.5

> When executing the following sequence of statements:
> ...
> ...which is as expected, while statement #B will throw an error:
> 		SQL Error [42883]: ERROR: function with OID 102048 does not exist
> 		  Where: SQL statement "CALL proc()"
> 		PL/pgSQL function test1() line 3 at CALL

It works as expected for me in current branch tips (including 13.12
and 14.9).  I recall we made some fixes in plancache management that
probably explain your issue, but I don't recall details.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18081: Spurious "function with OID ###### does not exist" error
  2023-09-04 09:12 BUG #18081: Spurious "function with OID ###### does not exist" error PG Bug reporting form <noreply@postgresql.org>
  2023-09-04 15:30 ` Re: BUG #18081: Spurious "function with OID ###### does not exist" error Tom Lane <tgl@sss.pgh.pa.us>
@ 2023-09-05 11:57   ` Branko Radovanovic <branko.radovanovic.zg@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Branko Radovanovic @ 2023-09-05 11:57 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

My mistake apparently, I got this on 13.5 originally and then I tested on
what I thought was 14.9, but it seems that was actually 14.4 - can't check
at the moment. I hadn't been able to find information on this particular
issue. Thanks, glad to see it fixed!

Best regards,
Branko Radovanovic


On Mon, Sep 4, 2023 at 5:30 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> PG Bug reporting form <noreply@postgresql.org> writes:
> > PostgreSQL version: 13.5
>
> > When executing the following sequence of statements:
> > ...
> > ...which is as expected, while statement #B will throw an error:
> >               SQL Error [42883]: ERROR: function with OID 102048 does
> not exist
> >                 Where: SQL statement "CALL proc()"
> >               PL/pgSQL function test1() line 3 at CALL
>
> It works as expected for me in current branch tips (including 13.12
> and 14.9).  I recall we made some fixes in plancache management that
> probably explain your issue, but I don't recall details.
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-09-05 11:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-04 09:12 BUG #18081: Spurious "function with OID ###### does not exist" error PG Bug reporting form <noreply@postgresql.org>
2023-09-04 15:30 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-09-05 11:57   ` Branko Radovanovic <branko.radovanovic.zg@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox