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.96) (envelope-from ) id 1w9Zin-001YO8-2W for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 02:29:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9Zik-005ux4-30 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 02:29:47 +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.96) (envelope-from ) id 1w9Zik-005uwv-1j for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 02:29:47 +0000 Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9Zih-00000000pSx-3GXW for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 02:29:46 +0000 Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-56d958880ecso953590e0c.2 for ; Sun, 05 Apr 2026 19:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775442581; cv=none; d=google.com; s=arc-20240605; b=VSZPghAbJ7cKFta74gH9trUGSXVIsheF51zt89g8DgpRolBR/WzKoSKdiR99zyrh9k LXtqK/R2CYNPEoC1g8mK1w7DMO7TcWnGgh2TbMf0RWjCUEbK9uzbMRCUPkkZQE6bPOR6 S/7rh571ucu3Dl/UzCjctcbWgGBFzxJ7/Lt/s53u4eytpHDxUPTHkryaprp/yqiJLvq+ qfyRpP/1iwf1ln1Q3LEv5SZINlyWjD7iYym8rkZzTUo3CxAMz2Vg+F4B/Gtxumv6xZbl SZ+992M1BITVp5qHxH1IjSa62QLZzToYvzYElzjsnSqUcoFQHltM3UYRmKBu6vaPl/zu Dgtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IGpS0ZQSZ91uO0GzDlACn/yQuEq/cArG3auJs9TMG+Y=; fh=CVbmABGaksUezyunDC/ZSK7RLdGGkqt1G/eQRcE7Wuc=; b=J277j4GkBKdzVe2ZGzxq2yxO3WiDnFav0YBQYtkETvD6vjN4BXzWdUXOK3HvERW3h9 zykNkJE8mtEQuPGDbC0qA+frISFiNZqdARKRwzQb6EIe9yi2ZFeBXp5ov7PLzdmGqnKk l4KQoBHcQjpHijBUnoadCaVcT27y3huCLkT3/LORyllFn0MKz40oDhdBcpriXUiav78v Gx3brMfCLZ78RTFMTyDmDEokeEYvHIrloLn37pV2kBEUOO0hV0siup9SvMQ8iNeGgzAi wqrUggA7gZFodxxWcM/FnEtxmHKRlRLSOPXI6Iyl6i1/QTje4rXTeby1qGUzY+1cBNKg +MwA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775442581; x=1776047381; 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=IGpS0ZQSZ91uO0GzDlACn/yQuEq/cArG3auJs9TMG+Y=; b=nHt/FcxhKul8YPNVZeZwdeW5XX+qKDYrgpEhLuh6Jni/NID+a0bQTnM/7L1sHLLjKD 4Nxk2e5vQGtDgsBZKJMG9mJFRwD+Sp2/iEYWIZ7Q9EPzTUxmxBFBFofakXHxaKDRR0IG ooVsad2pQ9AIHvswJXKpoqHYj2cP0G8kTZw1bXyevaovEUhrgFNEphaEfaoZ35rZlrbZ m3J1bvKZmSckAtT5vJ8ykhLLhERk4C7C4M0bK8saV5JY4P+4hsiFv6LddowKUzRtMp2/ sEsx/ut1V2FDlbJTR6CDJ+mBvRT3gbBLgWBhwD+ZkrH2K+vJR/x6vW5DS9xel84gm7Az VBHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775442581; x=1776047381; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IGpS0ZQSZ91uO0GzDlACn/yQuEq/cArG3auJs9TMG+Y=; b=X7N5qTS9PT5uPKx2Cj22XGLsVLS4RqSRYTwpPyYjCxwy5dgZV2vIPGEke0/FoPZEVF 3USkNJsCBLdaPCyy1ln8LF6gfTU3gnhIl42VDShHUua7XedwgoADYhCazccbCczNQX+j xUzIdMJD1l89GA9HRAG+Zb4imMHTC9sO7DxhIYc7HHsjDOBIcewXWxHmkpA8vnbfmwSG M//9FeceAaOaTJxx4YgHtrLvCerP5YSsNp6ORfn1HSBAXkQuAVJ9G057e80q+2/LfiB9 pbO3hSFa9jEPnDERYw1ImJ0IsUBWxHEBrOoIFLIMn1UA5nUv7YYFoSj1kRWiaZ2VyaJT eOhA== X-Forwarded-Encrypted: i=1; AJvYcCV5eMzz5HM1Wwu/8JMl5yDKGo0EI+Fz7IfyD/JpSVCGcnBgEf8q17qQmO2njGDRIuZQYEualCfYd8lx3ChR@lists.postgresql.org X-Gm-Message-State: AOJu0YyPDVbDfGjwx0TruoFQvREpQoqUphlNSZPfENLQ1p5Rytrv3h5Z EMtbf7Ht+HuvnwRLGmocnj/GnETVryUda/T0GeculBydksHZZfWUDmDpazHmdHsorXsckMC5O67 Q4qISmF2qDCWh5/ZokkK12mtD6vxQ7js= X-Gm-Gg: AeBDietusoI/CvERvJnwGviycY3gbpxx4XJq1FQEmzJGTToGChMSl5rgFH0eFQAP4kf rnGbSbbEomhh6nqicMBgXf3B3L2iIvdpmGmverFq0KBjWuHQrusEgzPEm/HIFN99QT8Ne9fAKgX UPtdD6axcXOvMibmyxdTWJpsweQPLg7pOU4KJMzhFuSBw2a9AkwbKf8ZPHYlm3XLeOYzeL3CDAJ lMIOu8zaI2LxYLiF2PWlVk77mvZoSfW8KXSKaLoNqM/LD2Wd7KQT6vK5GYM9aNCNjE+SBJ/oG1/ kp3w4xrUXHEowxo82ljbz3ghMlCpJUDt1Zbxqhf4GwobraDdE/Jt6VVO8gI5MpjmAaOdN+FPnT+ 5cJ3BA5BaQSXMYPRoTvrcpYYz1rg1B5NattJ/Iq/zPQCVqxNcWEtEEoqfpAGnyCmkTYjuY2lU5a df3+/YKylzseNGr4zaTgd0 X-Received: by 2002:a05:6122:4b05:b0:56d:3b69:87d2 with SMTP id 71dfb90a1353d-56dab9df26emr3948988e0c.11.1775442581291; Sun, 05 Apr 2026 19:29:41 -0700 (PDT) MIME-Version: 1.0 References: <1898722.1732732780@sss.pgh.pa.us> <2007224.1732773174@sss.pgh.pa.us> <1075425.1732993688@sss.pgh.pa.us> <345c20e5-a6d7-477a-9598-982661bb5740@eisentraut.org> <1990479.1733256458@sss.pgh.pa.us> <499425.1733936916@sss.pgh.pa.us> <685422.1756848241@sss.pgh.pa.us> <3819788.1775241322@sss.pgh.pa.us> <841583.1775414546@sss.pgh.pa.us> <944307.1775420103@sss.pgh.pa.us> In-Reply-To: <944307.1775420103@sss.pgh.pa.us> From: jian he Date: Mon, 6 Apr 2026 10:29:05 +0800 X-Gm-Features: AQROBzBrWWub3un6OuYRp831PrU0HEPJM1UxNOTJiJL6f2kYoRKCh8v_QYWK6q8 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 Mon, Apr 6, 2026 at 4:15=E2=80=AFAM Tom Lane wrote: > > Here's a revised patchset that I think is pretty close to committable. > I reorganized it some compared to v11: 0001 is still about the same, > but the business with allowing circular foreign keys is now in 0002, > because it seems like that bears directly on whether we should > consider 0001 acceptable. And then I squashed all the object-type > additions into 0003, because dealing with them all at once seemed > simpler. > > I rewrote 0002 rather heavily, mainly because it assumed it could > scribble on the input query tree which I don't think is okay. > The functionality is still the same though. > transformCreateSchemaStmtElements you mentioned * Note it's important that we not modify the input data structure. We cre= ate * a new result List, and we copy any CREATE TABLE subcommands that we migh= t * modify. But there is still no explanation about why it's not ok to scribble on the input query tree. V13-0002 looks great, and it is way more intuitive than my approach! Thanks! + DeconstructQualifiedName(qualified_name, &obj_schema, &obj_name); + if (obj_schema !=3D NULL && + strcmp(context_schema, obj_schema) !=3D 0) + ereport(ERROR, + (errcode(ERRCODE_INVALID_SCHEMA_DEFINITION), + errmsg("CREATE specifies a schema (%s) " + "different from the one being created (%s)", + obj_schema, context_schema))); There is no tests for the above. It would be better to have one dummy test verify the error message. it would be better change to + errmsg("CREATE specifies a schema (%s) different from the one being created (%s)", It's better for regex pattern searching, for new line you need to know how to escape. + (errcode(ERRCODE_INVALID_SCHEMA_DEFINITION), The leading parenthesis is not needed. > I was kind of sad that 0003 didn't support functions/procedures, > because (a) the SQL spec requires those in CREATE SCHEMA, and > (b) they are a flagship feature for Postgres, mainly because they > are such a critical aspect of extendability. So I added that, > which only required adding CreateFunctionStmt to the set of > supported node types in transformCreateSchemaStmtElements. > I guess at the time, I wasn't aggressive enough to consider CREATE SCHEMA CREATE FUNCTION. I saw the "Author" line in commit messages v13-0002 and v13-0003. You should be added as an author on both v13-0002 and v13-0003. Your changes simplified 0002 a lot, and you added the other CREATE SCHEMA subcommands to 0003. Except for the above issue, v13 all looks good to me. -- jian https://www.enterprisedb.com/