public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Tom Lane <[email protected]>
Cc: Kirill Reshke <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support
Date: Mon, 6 Apr 2026 10:29:05 +0800
Message-ID: <CACJufxEwkAJuCutLQdsxCOJkAvDS=9KgbphMVkXtQP8te=nciA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CALdSSPh4jUSDsWu3K58hjO60wnTRR0DuO4CKRcwa8EVuOSfXxg@mail.gmail.com>
	<CACJufxG+mrh2O9RS0gX43gU6sv+CMY847eMjMQpe8t4ou-2ryg@mail.gmail.com>
	<CACJufxFUdgqDiK9B+VNtnAwZOj=O3NqdLtXO_OrOwE5XPdCpBA@mail.gmail.com>
	<CALdSSPggNNvcad69dhUceZ_gPuEYnKNNd=WJ_WnP=YDmh=iwmw@mail.gmail.com>
	<[email protected]>
	<CALdSSPhckRXW+KEvdsUmkQ-ErbrP_vPNjGwgXNdpXDb8xnLEbQ@mail.gmail.com>
	<[email protected]>
	<CALdSSPgftbtV=UyeK_XcLit_mKQZr+g8pCxA0kLLxDi0kKwEGw@mail.gmail.com>
	<CACJufxH5TvkQiMOJ9dpDrDbRtyCa-yu+QOmYGt4WGGYVrN+P8g@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CALdSSPi1eFMhAY6Xc7ZShnU0m5YrswOFLyDKrFzLjYd7wefzQg@mail.gmail.com>
	<[email protected]>
	<CACJufxF28Vk27JhJ9u8tq10BoHLg=T9=wJ8zqTy_ajM4=Czunw@mail.gmail.com>
	<CALdSSPjH3Ag_6v=Q+mnhJocaYor0eGYOYkZWDG8w2rXRVioTXw@mail.gmail.com>
	<[email protected]>
	<CACJufxG7okkEs+kjCxR0b=6HnzBmMjkUszndT7puTQq6ADXwtQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Mon, Apr 6, 2026 at 4:15 AM Tom Lane <[email protected]> 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 create
 * a new result List, and we copy any CREATE TABLE subcommands that we might
 * 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 != NULL &&
+ strcmp(context_schema, obj_schema) != 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/





view thread (32+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support
  In-Reply-To: <CACJufxEwkAJuCutLQdsxCOJkAvDS=9KgbphMVkXtQP8te=nciA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox