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 1v3vp4-005lxp-3C for pgsql-docs@arkaria.postgresql.org; Wed, 01 Oct 2025 12:20:42 +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 1v3vp2-001kOz-3C for pgsql-docs@arkaria.postgresql.org; Wed, 01 Oct 2025 12:20:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v3vp1-001kOT-S0 for pgsql-docs@lists.postgresql.org; Wed, 01 Oct 2025 12:20:40 +0000 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3voz-0014xT-31 for pgsql-docs@lists.postgresql.org; Wed, 01 Oct 2025 12:20:39 +0000 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-38627e78203so2021995fac.0 for ; Wed, 01 Oct 2025 05:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759321236; x=1759926036; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=b2mOpJir1l1ZTDah+ZM90LneIYvFBR/5Ler0Wl5Q/nQ=; b=SFEXJ9uEpN6EB6FeDCxGDnhDp3Uhg+4vMPnoQKywWCdnx+wHThWcaOvRFYiBRGeNqI 8sFfiaQl8Kb0ycZ0zoYJa611XcgIpXTEKC/qukEiqr5pn/RaYx1SkgG7L5BypBZPUzxW i8vFSD5OOiFeKeV0O5d3jBr32fYkhXImd5zwnk3ujjKPNyG9HYKMenZKpZGkl9JbxAPd Q0N/AsC/s1xIVPmZJ5Fs63Mw0R+SzHJw4wfu9EaBymZz5+RyF1melpDuBfjsOKOiHrBd JMg+7reqLnfkiWabKT0pFIqgKt7HVKN28p/oO5TpU8OcZbf/x9m6RcgQIQ1PFpfMUrho FgMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759321236; x=1759926036; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b2mOpJir1l1ZTDah+ZM90LneIYvFBR/5Ler0Wl5Q/nQ=; b=QBGTuPvU1BsN6SVG4WgfFFe9+7SSvjaQhFWs0XV7lgQVuV2WTuBHemQsxU6sVXx1CQ U2eQXCjRbCB82bBppvBxM+tfA+C3PEBSnPA4/KQ1mj7Qf3sCI96K6i0eGCr9cJ+mnWzd 5n1IgRqJdqQrF05V+k7Ckp9241/WY2E+E0YSlM6K+QSxHgmpEWUYzexOQgfknQMK30u7 pTdls1jfk0eO2B1R41BPoFS0vBHFgQRwGI4z0ML30m0z1o8Y0KM7gx+IN+ANDCvgmw3O io/iyfXva1nmWWYYh6I20AjehAmJgG8tszT37Rht1H73Ww5IIxplcLuf4DMQ+cAYFrDj kebA== X-Gm-Message-State: AOJu0Yz+ywbD9mByTR/zCruigKyIRsV9tIiQJNFabFUUe4vTBZrbe+kH aZHi60rYbciR3Sy/1iSqLxavt+fSYwSHGSK6FLcp3Z/fNU8/P7hOgpaOYd2tpD8jIWJR6incjGD X5JSwfvFCfp3fzc65vjyXXysABrWxEU4= X-Gm-Gg: ASbGnct+DFO01A7XJkCvBxiWNUAGzjNY9VFyZwqFD7OiId9veQ37K3F39RtJO1ZnDcR K6cjWdZNBMdwyKKfuQGHtpz1CwH82d0cqCfNeAvATqZLb8h2kOgX0RrRfCd7Ix9Ruozj3V3tl80 +yuEMtszJSy9Kz/+b+yzNIVkmf1xu8vM98ThGGPZXmpSto/barqu2L3FCeS4Yt4NNITWSM468jP 0pb81vo0bgEhQhv7k3i0bZecsZElA== X-Google-Smtp-Source: AGHT+IHL1SAght5dzFFTaRN/rLQVmTw3BM+EfA7vkO8cKekWz1oLQY2oveXcxp1hgIroubPhquYIcpsjHCXIBxmwk0M= X-Received: by 2002:a05:6870:cb96:b0:34b:d24:3d8c with SMTP id 586e51a60fabf-39d0872f045mr1544363fac.45.1759321235599; Wed, 01 Oct 2025 05:20:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:5402:b0:5f3:5bf6:6b0b with HTTP; Wed, 1 Oct 2025 05:20:34 -0700 (PDT) In-Reply-To: <61f2cfed.17a9.1999f3ab6b2.Coremail.msdnchina@163.com> References: <61f2cfed.17a9.1999f3ab6b2.Coremail.msdnchina@163.com> From: "David G. Johnston" Date: Wed, 1 Oct 2025 07:20:34 -0500 X-Gm-Features: AS18NWDArpmmwaXQLd8GsygZMqllgAGjyQPWRmjLJsJiuSvaBs_IeBIXI2L8lvw Message-ID: Subject: =?UTF-8?Q?Re=3A_in_the_different_schema_=EF=BC=8Cthe_sequence_name_is_?= =?UTF-8?Q?same=EF=BC=8C_and_a_table=27s_column_definition_use_this_sequence=2Cso?= =?UTF-8?Q?=EF=BC=8Chow_can_I_identify_sequence=27s_schema_name_by_system_view=2F?= =?UTF-8?Q?table=3A?= To: yanliang lei Cc: "pgsql-docs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000004b3566064017e5ed" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004b3566064017e5ed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wednesday, October 1, 2025, yanliang lei wrote: > > dbversion180=3D# create table schema_1.test_tab_100(c1 int default > nextval('seq_xx_yy')); > Since you didn=E2=80=99t schema qualify the sequence name every single time= a default value is created the sequence will be looked up anew. The stored expression is not associated with any specific object. This is also why there is a separate step to mark a sequence as being owned by a table. That establishes a dependency that this textual form is unable to do. David J. --0000000000004b3566064017e5ed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wednesday, October 1, 2025, yanliang lei <msdnchina@163.com> wrote:
dbversion180=3D# create table schema_1.test_tab_100(c1 int default n= extval('seq_xx_yy'));

Since you didn=E2=80=99t schem= a qualify the sequence name every single time a default value is created th= e sequence will be looked up anew.=C2=A0 The stored expression is not assoc= iated with any specific object.

This is also why t= here is a separate step to mark a sequence as being owned by a table.=C2=A0= That establishes a dependency that this textual form is unable to do.

David J.

--0000000000004b3566064017e5ed--