Re: CREATE SCHEMA ... CREATE DOMAIN support

Kirill Reshke <reshkekirill@gmail.com>

From: Kirill Reshke <reshkekirill@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-27T06:38:20Z
Lists: pgsql-hackers

Attachments

On Wed, 27 Nov 2024 at 08:42, jian he <jian.universality@gmail.com> wrote:
>
> On Sat, Nov 23, 2024 at 1:19 PM jian he <jian.universality@gmail.com> wrote:
> >
> > I didn't add a doc entry. I will do it later.
> hi
> attached patch with thorough tests and documentation.
>

Hi! Thanks for pushing this further.

> one issue i still have is:
> CREATE SCHEMA regress_schema_2 AUTHORIZATION CURRENT_ROLE
>   create domain ss1 as ss
>   create domain ss as text;
> ERROR:  type "ss" does not exist
>
> the error message seems not that OK,
> if we can point out the error position, that would be great.
> like what we did with create schema create table:
>
> CREATE SCHEMA regress_schema_2 AUTHORIZATION CURRENT_ROLE
>     create table t(a int, b x);
> ERROR:  type "x" does not exist
> LINE 2:     create table t(a int, b x);
>                                     ^

To implement this, we need to include `ParseLoc location` to the
`CreateDomainStmt` struct, which is doubtful, because I don't see any
other type of create *something* that does this.


`make check` on v3 runs successfully. Test & doc seems fine to me.

PFA v4. The only change I made is for a commit message, and pg indent
run on this diff.

-- 
Best regards,
Kirill Reshke

Commits

  1. Don't try to re-order the subcommands of CREATE SCHEMA.

  2. Execute foreign key constraints in CREATE SCHEMA at the end.

  3. Support more object types within CREATE SCHEMA.