Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogIYE-0007aX-LL for pgsql-general@arkaria.postgresql.org; Thu, 06 Oct 2022 04:32:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ogIYC-0002ch-6U for pgsql-general@arkaria.postgresql.org; Thu, 06 Oct 2022 04:32:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogIYA-0002cS-EE for pgsql-general@lists.postgresql.org; Thu, 06 Oct 2022 04:31:59 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogIY2-0006oy-Ml for pgsql-general@lists.postgresql.org; Thu, 06 Oct 2022 04:31:57 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 82DA9320090B; Thu, 6 Oct 2022 00:31:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 06 Oct 2022 00:31:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1665030706; x= 1665117106; bh=5TdID1TdYVjmFFEcbP+jBYGu4CSDvTH2eLke2n65vtA=; b=m VmMZ6wjLGmrd7iahBBtBXQYeXmvyMBtUvyydNRNSZGeW7nFZti3icHncm9kZy1gL Grr/cbxBfw+PAPv5vo0eRMXtn2FXp+5drwBsP7wNeruq3i01pm9q7iYsstOxfgSv UvoSJepZMkQZFkp4ERngymQnoSDWYb2Ysl/8Ks/zcyntIg8vy+6Dk8/QoDLg6Brc 50cZNMBHqd/idLwoQ2aN4ZPOK+dhSj6oU95dhWEj6Powl8Z5y5eibU94CxBcNdXX obfWlHgaNoISt+ew7KvVSph7vFQDXxHG6KfThGE3MUUtjTzI7QHsArtOa6vAccCU UVCHHoKLB4KHnuoNASwwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1665030706; x=1665117106; bh=5 TdID1TdYVjmFFEcbP+jBYGu4CSDvTH2eLke2n65vtA=; b=tfoh8gKOy+RT04tFN 9zUiHvSBTsAL7k3q/aLzDkH5Pc4ScdtJTId9anwbyiaEbjYBgmS6Sg7MZsH2lcvS B9L3oHV0Pxg6Dr1qQvjqqzPKN9JMnyc469j6bMSAeD7M6zThZm6ppSTDB5LYU5pQ kB3ZyLUI1sEiXSZFwHG62tmg07Js73wcowUVQtYFE2ViPoZ0WPqjUrRDjyLc4B4s ZybeejRm2I+3QuTj411S4jY/Nfc6MD/jzIpWMaDOUORsHLnnZq7YXqJB4A+kAsOP Qhju8q9vDrUMWx0FZfY5pG0foWYFpQ8Y3HHdrFGq/HjR4DrDYtXdfEpbpx4z653O 6yEsA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeigedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeelkeegjefhkeetheefudevteehiedvudehkeduleet fedvffeuhedtvdegtdeffeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Oct 2022 00:31:45 -0400 (EDT) Message-ID: <4fc877f4-14c1-9753-ff42-10c16baa4076@aklaver.com> Date: Wed, 5 Oct 2022 21:31:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Content-Language: en-US To: Bryn Llewellyn , pgsql-general list References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/5/22 17:16, Bryn Llewellyn wrote: > The doc for "quote_ident()" says this: > > « > https://www.postgresql.org/docs/14/functions-string.html > Returns the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled. > » > > B.t.w, the value of "quote_ident()" rests on the distinction between a name (what you provide with the function's actual argument) and an identifier (what it returns). Some of you flatly reject (borrowing a phrase from Tom) the distinction between these two terms of art. Oh well… What it returns is text, quoted if needed: create table "$dog"(n int); select pg_typeof(quote_ident('$dog')), quote_ident('$dog'); pg_typeof | quote_ident -----------+------------- text | "$dog" The way I see is if it where an actual identifier then this: select * from quote_ident('$dog'); quote_ident ------------- "$dog" would be equal to this: select * from "$dog"; n --- -- Adrian Klaver adrian.klaver@aklaver.com