Re: CREATE SCHEMA ... CREATE DOMAIN support
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kirill Reshke <reshkekirill@gmail.com>
Cc: jian he <jian.universality@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-27T18:39:40Z
Lists: pgsql-hackers
Kirill Reshke <reshkekirill@gmail.com> writes:
> On Wed, 27 Nov 2024 at 08:42, jian he <jian.universality@gmail.com> wrote:
>> 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.
> 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.
No, that error is thrown from typenameType(), which has a perfectly
good location in the TypeName. What it's lacking is a ParseState
containing the source query string.
Breakpoint 1, typenameType (pstate=pstate@entry=0x0, typeName=0x25d6b58,
typmod_p=typmod_p@entry=0x7ffe7dcd641c) at parse_type.c:268
268 tup = LookupTypeName(pstate, typeName, typmod_p, false);
(gdb) p pstate
$2 = (ParseState *) 0x0
(gdb) p typeName->location
$3 = 21
We've fixed a few utility statements so that they can receive
a passed-down ParseState, but not DefineDomain.
regards, tom lane
Commits
-
Don't try to re-order the subcommands of CREATE SCHEMA.
- a9c350d9ee66 19 (unreleased) landed
-
Execute foreign key constraints in CREATE SCHEMA at the end.
- 404db8f9edbb 19 (unreleased) landed
-
Support more object types within CREATE SCHEMA.
- d516974840f4 19 (unreleased) landed