From: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | Re: order of pg_dump command "create sequence" |
Date: | 2025-06-06 14:07:47 |
Message-ID: | CANzqJaB+nyci9jK-ttnT=0rjhGotCzb-6fpoGKufzSxCimTC9A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Fri, Jun 6, 2025 at 9:54 AM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:
> On Friday, June 6, 2025, Антон Глушаков <a(dot)glushakov86(at)gmail(dot)com> wrote:
>
>>
>> /* create a function that will move the sequence */
>> CREATE FUNCTION public.gen_id() RETURNS character varying
>> LANGUAGE sql IMMUTABLE AS
>> $$
>> SELECT 'PREFIX_'||nextval('public.my_seq'::regclass)::VARCHAR;
>> $$;
>>
>>
>>
> Stating immutable is a lie and the breakage is on your head for violating
> using only immutable functions in generated expressions.
>
It's too bad that the server, when it sees the CREATE FUNCTION DDL, can't
notice the obvious (to humans) not-immutable nature of the function and
throw a warning. It would certainly be hideously complex code, though, and
miss lots of cases while throwing some false positive messages.
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
From | Date | Subject | |
---|---|---|---|
Next Message | Keith | 2025-06-06 14:18:40 | Re: order of pg_dump command "create sequence" |
Previous Message | David G. Johnston | 2025-06-06 13:54:07 | Re: order of pg_dump command "create sequence" |