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 1uLYfl-00BmKB-Q8 for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Jun 2025 02:43:41 +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 1uLYfj-00HajE-W5 for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Jun 2025 02:43:40 +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 1uLYfj-00Haj6-C2 for pgsql-hackers@lists.postgresql.org; Sun, 01 Jun 2025 02:43:39 +0000 Received: from 003.mia.mailroute.net ([199.89.3.6]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uLYff-0018VW-1V for pgsql-hackers@postgresql.org; Sun, 01 Jun 2025 02:43:38 +0000 Received: from localhost (localhost [127.0.0.1]) by 003.mia.mailroute.net (Postfix) with ESMTP id 4b91WB1Cdmzlmm8P; Sun, 1 Jun 2025 02:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:subject:subject:received:received; s=mr01; t= 1748745813; x=1751337814; bh=1ws2p0CeGSHBtea/JLlql72lB39N3yJFyfX 32l86Aow=; b=S5qpKX0TV3R3kjPv10dOdCB5obkYCliewysiY6tzk8BmdQthorQ 0R5WeD2dyc0DNi58olmbn48omJfaYCpQMdrMXSeU2fd05F9+XVjML+2Jr/1OUydj LudgPrRPA6twZPpIWsBFzBoG88o88toZA/xZtSgs4J6viCyb5XZvtR6TQGiM46pJ 1ncu/VcqEoJxshsLAp8cY/koDiUMm6F64P7JygZqo1dH/LclQDWREjoHBOPGgIIM QcpUBTAjatTrP9XAZcxzET+S46tB56OHbaxD425oQarcrxX+QQrp+O/pIZ79DBav d6Ewj52hCnp4IeWCnWXLpsB3prxKRu83pyQ== X-Virus-Scanned: by MailRoute Received: from 003.mia.mailroute.net ([127.0.0.1]) by localhost (003.mia [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 5lhAnjsnawS2; Sun, 1 Jun 2025 02:43:33 +0000 (UTC) Received: from [73.103.120.3] (c-73-103-120-3.hsd1.in.comcast.net [73.103.120.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jcflack@acm.org) by 003.mia.mailroute.net (Postfix) with ESMTPSA id 4b91W82q0Qzlmm7r; Sun, 1 Jun 2025 02:43:31 +0000 (UTC) Subject: Re: tighten generic_option_name, or store more carefully in catalog? To: Tom Lane References: <6830EB30.8090904@acm.org> <3020890.1748735715@sss.pgh.pa.us> <683BA390.7000903@acm.org> <3029560.1748740373@sss.pgh.pa.us> Cc: PostgreSQL Hackers From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <683BBE52.8050900@acm.org> Date: Sat, 31 May 2025 22:43:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <3029560.1748740373@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05/31/25 21:12, Tom Lane wrote: > I think you're overthinking it. There is one round of dequoting > and downcasing in the grammar, and after that a name is just a > literal string. It's perfectly okay to just store that string and > do exact comparisons to it against other names (which themselves > must have gotten through the grammar). ^^^^^ ^^^^^^^^^^ ^^^^ ^^^^ ^^^^^^ ^^^^^^^ ^^^ ^^^^^^^ Right ... until you're in a situation of comparing it to an identifier that came to you some other way. The old bug where PL/Java would let non-superusers change the public-schema class path by spelling public in different case was possible because the set_classpath function takes the schema as a string argument. Developers of FDW handlers are likely to have option names embedded in some kind of PL source code. Those don't all arrive preprocessed in the same way as those PostgreSQL parsed. > IOW, your claim that there is a semantic difference between foo > and "foo" seems wrong to me. They are equivalent identifiers. I think it is true that I can treat them as equivalent for matching: it falls in the rule in the spec that says a and a are equivalent if the case-normal form of the regular one matches the exact form of the delimited one. So yes, I did overthink it a tad: if I see foo in the catalog and Foo in some function argument or PL source code, I do need to know whether the argument or source literal was intended to represent a regular or a delimited identifier, but I don't need to know that about the foo in the catalog. I knew that once and wrote code that knew it, but forgot for a moment here. > The problem for FDWs is that it may not be okay to find out whether > options are valid at the instant they're entered --- you might not > be able to contact the remote server, for instance. Hmm, ok, so is the argument that the provisionally-enter-in-catalog validation approach wasn't used because a validity verdict might not be forthcoming right away in the transaction where that is done, and that this alternate approach of passing some partial information to a validator in an array solved a problem that would otherwise arise? I don't think I'm seeing how the one approach ends up better than the other on that score. If I write test code, it sure seems the validator as currently implemented gets called at the instant I do the CREATE, and I'm not sure what else I could imagine happening instead. Seems like "some options might need server connection to fully check" is just an inherent, understood limitation no matter how the validator API is designed. A validator author surely thinks about what checks are basic sanity checks on syntax and compatibility of different options and what can be checked locally and what requires a server connection, and for what options it may be necessary to check the basic syntax and then say "ok" and hope for the best. Or take the more pessimistic approach and just reject the declaration and make you try again when the server's up. But to have to tell a validator author things like, you can't check your locally-declared table options against what your locally-declared server options are ... you can't check your column options against your declared table options, or even what table the column is declared in, or what the column's locally-declared type is ... your server option validation can't know anything about the FDW options and the server 'type' and 'version' aren't even passed to the validator ... just because our API's that way .., ... things like that seem more like own-goals. Fixing them wouldn't make the truly inherent limitations go away, but then at least there'd just be the truly inherent ones. Regards, -Chap