Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNXjo-0048qe-MM for pgsql-admin@arkaria.postgresql.org; Fri, 06 Jun 2025 14:08:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uNXjm-00AycP-A1 for pgsql-admin@arkaria.postgresql.org; Fri, 06 Jun 2025 14:08:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNXjl-00Aybh-SW for pgsql-admin@lists.postgresql.org; Fri, 06 Jun 2025 14:08:02 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uNXjk-000aQP-2V for pgsql-admin@lists.postgresql.org; Fri, 06 Jun 2025 14:08:01 +0000 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-72c172f1de1so1224091a34.3 for ; Fri, 06 Jun 2025 07:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749218879; x=1749823679; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3rzXJ2AiETQNfYc/GIIxsfNMNvEDtC+IIk4lUasr5+M=; b=U3j/4mmcgV68LAbySUTmB0pNZXSVe/6ClpRKdel1Hu9I5U9SJPcCobq51gDVXTkcm8 2Ak6c36GP4qBRceQiA8sLgzXwGFWRVDvbjDGmNZnBEXRat376hP95/Uro47pGkGI2hZw BFGkxCTfKiPyKDTFZKlETH8TmIXL8W6W4S1HwFG3R+0mOMrAcrOQzBwLCAMI+kcZFSG1 7C+YcxbCI5cTidHYIEJkId/gO7amXPGkqW492NwtqpCIO+PTAQUKGneeU40O7DpTx2x5 6Oz0hFhKOAmqVUlYTMkc1fuiYOSE9J6dyLUgFR38Dbm53HTj5dARgMvmWTJjPK/Up+XQ Zx9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749218879; x=1749823679; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3rzXJ2AiETQNfYc/GIIxsfNMNvEDtC+IIk4lUasr5+M=; b=inKZGXxx5XY6Y9/JK4OS9v2r5gpJIaJmeoq/+Cbkn7Onr5TG2Sqlaow4qcQyVFAvi8 23hLwFq5qv3wBg7PpEPb0eA0nmcI7npE5mVPCNcEfAX6yONXi8n8GPi/qBU6Fw6XuHNq Q619Obigt3dNCxLPgDk9H4b2JxztOX4ALSHjFenP/eJmp+aaBoTjTkVPJaxAFionIe/M Amk6Za/R7DQhGzpK0H3coeLB7L5ou/4F0mc4ZhzM/GiFj5ncQX55M2nZgJWOvOXWQlSf tFVY8BAb6AzwZweLUtxLqr02+3pNWcPM6Q9PR4/b1gbTz43wM88tDbplUKBRXU5MQ0xo zEdQ== X-Gm-Message-State: AOJu0Yy2RxyC0OBJL2bfiTeeVqGp43wC3FcYYAY+gOiN5Ba6aaUMg6Fn hFNo5/wkIOvGm4CMwI0reDj8d5domfKz7ckKEL3GVcX/PKCt+2G0JWla1NaHWlKc+XhTW2Hkip7 Nr8dv0CPP10Pij8Vw2J/ZHK9NX+mhGaViKw== X-Gm-Gg: ASbGncvPU5mm+Oa0dnnRCZSAulMzdzbvicOmK5vLE+Heqxuzod9zNZ0/NFT40zv6VSO 0GhOGpmCNHr326h312bKmlhF1WdG8EexN6BUz2j0c63hwlTp96emcLX7OSVkxkI/hS+Kb0x28u3 pO6ggqGbSgS2H9FdiSV8s3bh22Vorvh0BdldAvS4OSpOq0 X-Google-Smtp-Source: AGHT+IHSk1GrGeEZfsU8U6chV5y3q/o0vVf0fVetV/++fRTND2FmcafiB+9yQ5TFe0rkPdtewXPcES6UEaWZDqNteac= X-Received: by 2002:a05:6870:1994:b0:2d4:ef88:97bb with SMTP id 586e51a60fabf-2ea00633f53mr1964253fac.1.1749218879171; Fri, 06 Jun 2025 07:07:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Fri, 6 Jun 2025 10:07:47 -0400 X-Gm-Features: AX0GCFuh7ZD_MKOuICZS98EXDcbOmWieP7rSeOvve0dQIqzKd4X7o9xMiszuQWo Message-ID: Subject: Re: order of pg_dump command "create sequence" To: "pgsql-admin@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000ed70bd0636e7c1fb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ed70bd0636e7c1fb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 6, 2025 at 9:54=E2=80=AFAM David G. Johnston wrote: > On Friday, June 6, 2025, =D0=90=D0=BD=D1=82=D0=BE=D0=BD =D0=93=D0=BB=D1= =83=D1=88=D0=B0=D0=BA=D0=BE=D0=B2 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. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000ed70bd0636e7c1fb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Jun 6, 2025 at 9:54=E2=80=AFAM Da= vid G. Johnston <david.g.j= ohnston@gmail.com> wrote:
On Friday, Ju= ne 6, 2025, =D0=90=D0=BD=D1=82=D0=BE=D0=BD =D0=93=D0=BB=D1=83=D1=88=D0=B0= =D0=BA=D0=BE=D0=B2 <a.glushakov86@gmail.com> wrote:

<= span style=3D"font-family:monospace">/* create a function that will move th= e sequence */
CREATE FUNCTION public.gen_id(= ) RETURNS character varying
LANGUAGE sql IMMUTABLE AS
$$
SELECT &#= 39;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 expres= sions.

It's = too bad that the server, when it sees the CREATE FUNCTION DDL, can't no= tice the obvious (to humans) not-immutable nature of the function and throw= a warning.=C2=A0 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!
--000000000000ed70bd0636e7c1fb--