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 1niMbq-0007xe-MY for pgsql-general@arkaria.postgresql.org; Sat, 23 Apr 2022 20:44:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1niMbp-000764-JA for pgsql-general@arkaria.postgresql.org; Sat, 23 Apr 2022 20:44:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niMbp-00072J-7F for pgsql-general@lists.postgresql.org; Sat, 23 Apr 2022 20:44:01 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niMbj-0005wB-PG for pgsql-general@postgresql.org; Sat, 23 Apr 2022 20:44:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B62EE3200C17 for ; Sat, 23 Apr 2022 16:43:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 23 Apr 2022 16:43:53 -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=fm3; t=1650746633; x= 1650833033; bh=lXnQbIJVf/Whaf1GfQZLi4vFhd3uQ5aQoyzUSnr0ZdY=; b=b n1qNZWfERuyyXgz4ZVgUkDKGkbJSMF9WqDo3J+yFOpmDIQM+3LWGu5He11LIKb3z wOmCUl5UCapOewR6LzdbBFr6OExosQW7hpXEnsHGh4XpArrmjcu7ZysH3nJm+ll5 SJHkdDDVISxa9JGX1wImYNXPFA29Rv8HmOp5P/QUyxBfYRuFtEDlrpoHVR7PMUou 0Va/gYagKRlE+Y4urXlIXcy3u7rr9EsZV3LA6VnqYjMbsU+JK82ORjaqm8ZrGXoA kU8vts3Q/szNb8WSTgScOcPXY2mlCI9HZZCYSoeMRq9Ipkx534BnmrfjeWCXe6S6 eVEH18awnpqWGvEnZMwiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.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 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1650746633; x=1650833033; bh=lXnQbIJVf/Whaf1GfQZLi4vFhd3u Q5aQoyzUSnr0ZdY=; b=AZm7fBxLudDWbvVfJBlwoJuggUY62ZVGoSZ33wjGaN0W 8AB+YAZWN8P3KCo00MwS3v5NxyAZ93CKL88eMEdVkM9NgGxCNiLygjuafZxRJIMQ lttvffq7ZYy3DQgqe8+QR7a4Mt5NrwVKA7PeWMpV3evP5Rqt0IY9jnq3Zv8EWigQ gcGX7M9Y1DWKT4PDqO8ltFPv5pFxinGKKYVAENThzjqAFvvRibffBQv/Mvr2lK/m JlodNDMRsnFZbfi8VhmAVBfwTEe3+gMTiYk+q+IQsVF/p/v1lHkiO4k068DY3Ak7 UyJTXARNNCzedXgnQeGdqAmn4SlipwB9PEHSLed5Bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrtdeigdduheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepvedvkeeihf duhffhtdekleegffduiefgteejgeffgffhteefleeludfgleelgeevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 23 Apr 2022 16:43:52 -0400 (EDT) Message-ID: <8064cab0-31b1-7ac3-ebdb-c1522f4cee6b@aklaver.com> Date: Sat, 23 Apr 2022 13:43:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: PG14: "is of" vs pg_typeof Content-Language: en-US To: pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/23/22 13:14, Karsten Hilbert wrote: > PostgreSQL 14.2-1 > > Dear readers, > Now, pg_typeof is an alternative but that only goes so far: > it requires laboriously constructing an array on the right > hand side for the above use case, along the lines of: > > select pg_typeof('a'::text) = any(ARRAY[pg_typeof(''::text), pg_typeof(''::name)]); > > Is there anything obvious I am missing for easily > resurrecting the above "is of" use ? Actually it can be done as: select pg_typeof('test'::text) in ('text'::regtype, 'varchar'::regtype); ?column? ---------- t select pg_typeof(1::int) in ('text'::regtype, 'varchar'::regtype); ?column? ---------- f > > Thanks, > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B > > -- Adrian Klaver adrian.klaver@aklaver.com