From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
To: | Todd Brandys <brandystodd(at)gmail(dot)com> |
Cc: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18647: INSERT statements execute functions twice. |
Date: | 2024-10-09 13:55:58 |
Message-ID: | CAKAnmm+H1+sxxqUKi3DgboVjFMKYjOusDJMYHC1tgRfF1isW+Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
More detail is still needed. We don't have access to your schemas and
functions. But at first glance, there is something else going on, not
explained by the given code. Try to remove the unimportant parts and get it
down to a reproducible test case. For example, here is a test case showing
the expected behavior on Postgres 16:
create function mynextval(text) returns text language plpgsql as $$ BEGIN
RAISE NOTICE 'Inside mynextval!'; RETURN 'x'; END; $$;
create table foo(a text, b text);
greg=# insert into foo values (mynextval('abc'));
NOTICE: Inside mynextval!
INSERT 0 1
greg=# insert into foo values (mynextval('abc'), mynextval('def'));
NOTICE: Inside mynextval!
NOTICE: Inside mynextval!
INSERT 0 1
greg=# insert into foo select mynextval('abc'), mynextval('def');
NOTICE: Inside mynextval!
NOTICE: Inside mynextval!
INSERT 0 1
greg=# insert into foo select x from mynextval('abc') x;
NOTICE: Inside mynextval!
INSERT 0 1
greg=# insert into foo select mynextval('def') from mynextval('abc') x;
NOTICE: Inside mynextval!
NOTICE: Inside mynextval!
INSERT 0 1
Cheers,
Greg
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-10-09 14:51:54 | Re: BUG #18647: INSERT statements execute functions twice. |
Previous Message | David G. Johnston | 2024-10-09 12:40:38 | Re: BUG #18647: INSERT statements execute functions twice. |