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 1tGMx4-002YsR-MA for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Nov 2024 18:39:50 +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 1tGMx3-000AAP-7s for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Nov 2024 18:39:49 +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 1tGMx2-000AAG-U6 for pgsql-hackers@lists.postgresql.org; Wed, 27 Nov 2024 18:39:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tGMww-004Myz-MC for pgsql-hackers@lists.postgresql.org; Wed, 27 Nov 2024 18:39:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4ARIdeuO1898723; Wed, 27 Nov 2024 13:39:40 -0500 From: Tom Lane To: Kirill Reshke cc: jian he , PostgreSQL Hackers Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support In-reply-to: References: Comments: In-reply-to Kirill Reshke message dated "Wed, 27 Nov 2024 11:38:20 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1898721.1732732780.1@sss.pgh.pa.us> Date: Wed, 27 Nov 2024 13:39:40 -0500 Message-ID: <1898722.1732732780@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kirill Reshke writes: > On Wed, 27 Nov 2024 at 08:42, jian he 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