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 1v3w67-005pYJ-Ie for pgsql-docs@arkaria.postgresql.org; Wed, 01 Oct 2025 12:38:19 +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 1v3w65-001uFn-9r for pgsql-docs@arkaria.postgresql.org; Wed, 01 Oct 2025 12:38:17 +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 1v3w65-001uFf-2q for pgsql-docs@lists.postgresql.org; Wed, 01 Oct 2025 12:38:17 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3w63-000sAR-0x for pgsql-docs@lists.postgresql.org; Wed, 01 Oct 2025 12:38:16 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-30cce892b7dso3973222fac.1 for ; Wed, 01 Oct 2025 05:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759322295; x=1759927095; 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=jnxKo971LswvfCFI3+ddw9LtZkk046lrnGVKvg8BbQU=; b=Ceg+SEYM+bPy39sw4gx5T8XgufuwwZqIUDH1aRy8wR28wvPlRyLs66GTJp98Yrcdpa bLxSpXxyoftOfjnK/c0i3t6LsfryoRpEt/cKS2jysUqcd2b358hJuAo8WLQICHb9Zb2v fTNXPMec8tTFf3J4V9PFVv8fPPFD+PPFxFTEwAL6S3GvYnCJeFtOII6cL8ZE0r2P4gMz mgkJShhXAklBqH+AmjrLJXKRaXGg/kwOtoj0jH0oo7JOkBElT1CPFfKYHS7H8CtnubXa dbpn60iQvjkqdfrGw0x2HnmxkK/dji4oqOWHl1crLe9Hr7U7op16/hhqTuvZ8+6BM8Dx h+Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759322295; x=1759927095; 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=jnxKo971LswvfCFI3+ddw9LtZkk046lrnGVKvg8BbQU=; b=b0uUwws7nKvEhHJFd7kp9x+tAEkVttRuy+3yGHTtDf0dnCIL+ip15aRueaBCFZNTr+ cCZUebwNiy55PzBoPzEkP/ACgIEpb+x+cpXxgg9NQuFdgUXKI4W/Rz2U+ycwRJ1ByJyi IfPbaYDWBCsoWAmHaUEnEsOFZtSfO7hm8KGnJp0LXVUeTses6JOkJYzlk7BbOuvBQTgP 6RHpyhTFxwl3x7SN7TnbarzkoOZlkaEOP2EiMyvj0ASIoSaHzp/Ipv2fkRdwfI3vOTuE 1QsaONnIveBqzl71W1hLUufMyT0XH25Zm1PbSw25YyhGLckTe4lXDWNjONSWl0T1MJRN 8BQQ== X-Gm-Message-State: AOJu0YxcCNhlFPe+Nc2R1jTyk0V/GHWKW9pBcZJhEmTvbr6+CDrnoaLZ E6YwaqPds8Xjs0ogr10tDti4NZbBkonXE40qZb7yYKQOwMiZiOHGifbih26AAtf7Gl8L9YYxg4A I9hRBbZUtD+aBsEBHAaZzDkcQIwcb72g= X-Gm-Gg: ASbGncuz6MfHVrUH3BK/Lp9/Unusu+ve7uXjTeewT1DTUqPrPaFSlcSb6mkABTcm3UQ sjK+qXcoeTY1IXaMQtM4QFQ90RsNR40tneFoJaoYdHlA2weq5DNoaZkF6VHQIHzdnJCMQNI0tdS 2HkcodeHgjl1LuAO9BF2rvMsObPk+KLMMQuBjAOjPhANaTytvXpaRt6rKy1AtHRa1AqS+icixpY D2oJhi1LFNFeyTz4BeRzgLgs22s6A== X-Google-Smtp-Source: AGHT+IGSjJol/rzsHx/g3G54afE5KzI5mGL7nG5hYSx04P+XPnOF62NX08EKcx1vZkcB3NhuXbdgS3NHNYmELOihVmY= X-Received: by 2002:a05:6871:549:b0:2e8:f5d6:2247 with SMTP id 586e51a60fabf-39bae57485fmr1782363fac.32.1759322295291; Wed, 01 Oct 2025 05:38:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:5402:b0:5f3:5bf6:6b0b with HTTP; Wed, 1 Oct 2025 05:38:12 -0700 (PDT) In-Reply-To: References: <61f2cfed.17a9.1999f3ab6b2.Coremail.msdnchina@163.com> From: "David G. Johnston" Date: Wed, 1 Oct 2025 07:38:12 -0500 X-Gm-Features: AS18NWDoYLz8zPL91pMxqyWys9RYpJrg9UDRwB2EDuoSbUoYhWkpYk-wlb5fOzM 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="00000000000074d4c50640182470" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000074d4c50640182470 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wednesday, October 1, 2025, David G. Johnston wrote: > 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 ti= me 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 i= s > unable to do. > > Ignore that=E2=80=A6we do stored the parsed representation which nominally= has the schema recorded, it=E2=80=99s just that the text serialization it too =E2= =80=9Chelpful=E2=80=9D by inspecting the search_path and only produces the schema prefix if it would be necessary to resolve the reference. David J. --00000000000074d4c50640182470 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wednesday, October 1, 2025, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, October 1, 2025, yanliang lei <msdnchina@163.com&= gt; wrote:
dbversion180=3D# create ta= ble schema_1.test_tab_100(c1 int default nextval('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.

=C2=A0
=C2=A0Ignore that=E2=80= =A6we do stored the parsed representation which nominally has the schema re= corded, it=E2=80=99s just that the text serialization it too =E2=80=9Chelpf= ul=E2=80=9D by inspecting the search_path and only produces the schema pref= ix if it would be necessary to resolve the reference.

David J.

--00000000000074d4c50640182470--