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 1tHgke-009Csa-10 for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Dec 2024 10:00:28 +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 1tHgjb-006eBK-Vy for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Dec 2024 09:59:25 +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 1tHgjb-006eB9-Iy for pgsql-hackers@lists.postgresql.org; Sun, 01 Dec 2024 09:59:24 +0000 Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tHgjZ-000SpM-0f for pgsql-hackers@lists.postgresql.org; Sun, 01 Dec 2024 09:59:24 +0000 Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-5152685b0d7so903421e0c.1 for ; Sun, 01 Dec 2024 01:59:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733047159; x=1733651959; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0mjCCYxgvGteb6IdkcnHUYqXnhgQLiYou88Rtpm9q1o=; b=OrMPXNEJhAxfc74ndLkHZ/mrJs/+Q3UVqtDR1rbZ+SOnogSZQnES/SagHkYT7WpW/K H1arcDjOEXUD0wB+ikkUelZw3Fbz/NdQEdGeCxZNAwVHvX60s2DMng0O/NxhO8vzxGBP MnMX0onHrjyAvQ92SremLGOTdMgcbMsOsSieXZ/uk+CmSETwNUwua5/Pqy5WLK1HjmFL pMFNNM1GyXHxwJ8b9C+X/omICkY6Fd/vb7Pa5YE9su4F6n2WeuYdPfFpeZg730Ld5vGJ NouIfKGxAN/8/i9StpyxnzgfaSPUXWSHM44qadQK7v/Bj6GsArV2dWu4Sp6ZzvhUbJIo NG/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733047159; x=1733651959; h=content-transfer-encoding:cc: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=0mjCCYxgvGteb6IdkcnHUYqXnhgQLiYou88Rtpm9q1o=; b=Qo5krwTHYRX5KYdn/gs34h+r0yc2U7n7I34XV8Dvy3oAoPrACmXjJh7feSUGJhvaH0 EPz31GAJKwmzEglfzzgaHzhEkv4ElY5epXWxso9QhSEAR49Xi/im0D7cN/SN+9qOP8iB FHG1fbfJZRkplo4Xw89ITt+1ROUNVgOHEdxqDRAOQHWwyYOZGYudosp1UEjiVsbyAvxe oYBoguNRcCSsupe5tS6vKhDJl01ZyK2/D+yCiPJI9wu/G9G+/YSu6chA7QsaRdQzLfVY uME2d40WtIfVFsmfykZk2wb4eIoTZJKchztdsJZFsZ15k1z1yY0E3s+oEw0yk1N/svKH npiw== X-Forwarded-Encrypted: i=1; AJvYcCU7JTVS7n61yfLszVPSyfgLJYC20Df2m2oGeNKefY7VenQMrgYMTxuA+TE7VenDmH8Sf6iW/l539wYR1Tgj@lists.postgresql.org X-Gm-Message-State: AOJu0Yxp+MsrRQcaCPfhMLEVy44i7tYhaDPlky2wWxrAjvSVW7V66GGR V9A+TRgp+T4Ryf3BQdr3QD2y2hLTNkyLquZU0aohLuTYFWTVOhbAAPcITFtlC272roO1HGKLcNy r296dRyH6KgaiaAYIoXTyQIQqNEk= X-Gm-Gg: ASbGncsVbfh/g/ZMnnUumWSnYCUqS5SMCS50kvxPSem15PT/O5PWsXBoG8l4qF/QJ/I xQ17STASHwyWGexo+r0ssq49QNA6+kBRB X-Google-Smtp-Source: AGHT+IGY2BwKz2wssztSd7FPxC0RmRmxip9bWmeyoq/jxFwXpiBXOR/WOGz9xeTDv9qR61BUJgV2hH5z8/BV6PTHtAk= X-Received: by 2002:a05:6102:38d4:b0:4af:5972:d593 with SMTP id ada2fe7eead31-4af5972d65emr13694573137.17.1733047159234; Sun, 01 Dec 2024 01:59:19 -0800 (PST) MIME-Version: 1.0 References: <1898722.1732732780@sss.pgh.pa.us> <2007224.1732773174@sss.pgh.pa.us> <1075425.1732993688@sss.pgh.pa.us> <1220935.1733009604@sss.pgh.pa.us> <1273964.1733032384@sss.pgh.pa.us> In-Reply-To: <1273964.1733032384@sss.pgh.pa.us> From: jian he Date: Sun, 1 Dec 2024 17:59:08 +0800 Message-ID: Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support To: Tom Lane Cc: Kirill Reshke , Peter Eisentraut , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Dec 1, 2024 at 1:53=E2=80=AFPM Tom Lane wrote: > > Kirill Reshke writes: > > 3) Why do we delete this in `create_schema.sgml`? Is this untrue? It > > is about order of definition, not creation, isn't it? > > >> - The SQL standard specifies that the subcommands in CREATE > >> - SCHEMA can appear in any order. > > In context with the following sentence, what that is really trying > to say is that the spec requires us to re-order the subcommands > to eliminate forward references. After studying the text I cannot > find any such statement. Maybe I missed something --- there's a > lot of text --- but it's sure not to be detected in any obvious > place like 11.1 . > I checked, you didn't miss anything 11.1 didn't mention "order" at all. > (I'd be curious to know how other major implementations handle > this. Are we the only implementation that ever read the spec > that way?) > quote from https://learn.microsoft.com/en-us/sql/t-sql/statements/create-s= chema-transact-sql?view=3Dsql-server-ver16 <<>> CREATE SCHEMA can create a schema, the tables and views it contains, and GR= ANT, REVOKE, or DENY permissions on any securable in a single statement. This statement must be executed as a separate batch. Objects created by the CREA= TE SCHEMA statement are created inside the schema that is being created. Securables to be created by CREATE SCHEMA can be listed in any order, excep= t for views that reference other views. In that case, the referenced view must be created before the view that references it. Therefore, a GRANT statement can grant permission on an object before the o= bject itself is created, or a CREATE VIEW statement can appear before the CREATE = TABLE statements that create the tables referenced by the view. Also, CREATE TABL= E statements can declare foreign keys to tables that are defined later in the CREATE SCHEMA statement. <<>>