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 1niM8x-0006de-0Q for pgsql-general@arkaria.postgresql.org; Sat, 23 Apr 2022 20:14:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1niM8v-000110-S1 for pgsql-general@arkaria.postgresql.org; Sat, 23 Apr 2022 20:14:09 +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 1niM8v-00010p-G8 for pgsql-general@lists.postgresql.org; Sat, 23 Apr 2022 20:14:09 +0000 Received: from mout.gmx.net ([212.227.15.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niM8t-0005j6-Cd for pgsql-general@postgresql.org; Sat, 23 Apr 2022 20:14:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1650744845; bh=31ALfQIWJxX/ELNs/7l5GPFTGMlaJm8cRzAwMZXkBms=; h=X-UI-Sender-Class:Date:From:To:Subject; b=FvNzNNblBlu0mBfponhRJ2lZSveDR0EkXvTB0mlL+79TO5qaHruV9vpkJ1yNqsx39 0IsM0YGaflmY8PoJ5GF4la4FKdhDvA/H9iE6iRtSAkb0y58MwIy4MsLg3BhNhx5wef FK65Uw118xHUNytIX9STYepw5HCkNXmEOyWLlXyg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([84.190.227.248]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdNcA-1oHgxY3VwG-00ZLJJ for ; Sat, 23 Apr 2022 22:14:05 +0200 Received: from ncq by hermes with local (Exim 4.94.2) (envelope-from ) id 1niM8p-0004t6-7C for pgsql-general@postgresql.org; Sat, 23 Apr 2022 22:14:03 +0200 Date: Sat, 23 Apr 2022 22:14:03 +0200 From: Karsten Hilbert To: pgsql-general Subject: PG14: "is of" vs pg_typeof Message-ID: Mail-Followup-To: pgsql-general MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:4W63flDQ6lUv4onGmvO1jiglnqC+QRS6A+GxxM6nKeLHTG+x0Nq oN7YQE+onIUTvj8Ja5nOGgMP6OZiAooZOeuFV14Ay8BiJh2qSaA12crbopEMZv5K3bdLzu9 C0eVzoIqYyuImB41z7/b57E6wYB2KAvCMzEXi4ng+Nj6Ct3xY+BR8+v10Vp723CB7SCPOy6 mum+ROgJRkmxxrJRh1YqQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:OkdOBaWhFkc=:uyS4TqL4n6B/RX1C95Mlg7 uxvazc+ou6psl+W8c6xBqUTcrtVuF+7Lv6V4zQSX4Rs9Lyn7B/6K+x4gfAToJngSkEE/Z+41N 934Yu9KtGhI3Hc5WeJwbI4nKT4SCDDwkBMfUTsOmKtSPlxYAdvMH8Jk1DroIzow0W7lIg8ifU aSoSKNJiH604IfS343Wx8Sm70ndwt2Zd9+sT89cV4iwNnGFJknb/lbpGYfz70iAl4htw240Ux n4hz8Il8wUoc8gr6t/qlivOKzRkXn8E8GpOkc9vACsnXbrQf7mudzSopeVdFLGmj3WW+8WZEc VJWqS2s04dgRtYZ8kWnuzEh+4qvVxkyllGxrqh1+wQiuifcyLCua7N01a/xLXdvr22wC5r6yq EkemxAU9fm3dFbcLbcQgHB0wtkk3dWbbPgSwLUkdkqEOBx6Ge1cSLCUJbtWtnVl0654LFbRXr OWsGvtWcPtL0LUqeO5Xr1dyC2YcdCIzK2DnSOTrmPNR/dIEVLSR7NXPsh5CwlndyV9iE/84EQ 5l5/zslNnxQ1Jd5RQTXC7F6TxmJYWvgI6HthB2nGKNC5aWF9QIOJhG2wqvoaOtwxqslBW1ht+ UzpioKuV8XjdRUTlEnHQWnqUVbX9XWFmEjHQo1ks5+9BLDZiMTztT3A6A8RVtRZEG0uztkbYf pI61oTnYQD6aUDsevPLrlx4+zDgzuI24H+cVo+xSVbXkFTmEHWDuMuiIoM8O0WywR10Hh+hww WuYj71ZnFfq2MYDMKkMwUgt+jm2mI99msp4RF7OM+4kkFex2hhNWSiUqbBrU6bEZWwGt1QXRO 5kLD1QmRrDTr1644C3U5NRohn8I0hqIKjzvnVzdeFmZrOj1eG0caa12pvmcpj6KFa0/+bKKja J6YlY/bry1xkqqNOAc1qLP/fVQZ22VD5S5ilyPy7djNoZ0FqkJMQCfRHoA2v4Z7WMNzQw5F8U 6R/XHPdZmFooM64DT8U448sv96NyiNcuyqpoRCb8cKU1a8hOWJdeogYp5FF2POWz0TpcESECU dpzCbo5RoB+Z70J6zSydR5lu3lIYLClvJNkcl19E54Oiqr5LcG2vvu7YWtsl4/z/9JOSL8zBw rCpw1rVhc5HZhQ= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PostgreSQL 14.2-1 Dear readers, it used to be possible to say (inside plpgsql): if _value is of (text, char, varchar, name) then val_type :=3D ''string''; elsif _value is of (smallint, integer, bigint, numeric, boolean) then val_type :=3D ''numeric''; elsif _value is of (bytea) then val_type :=3D ''data''; elsif _value is of (text[]) then val_type :=3D ''str_array''; else raise exception ''cfg.set_option(text, any, text, text, text): invalid t= ype of value''; end if; where _value is some typed value. As of now (not sure when that started) PG 14 is giving me gnumed_v23=3D> select 'a'::text is of (text, integer); ERROR: syntax error at or near "of" (same thing inside plpgsql) where the log says 2022-04-23 19:58:33 GMT ERROR: 42601: syntax error at or near "of" at ch= aracter 21 2022-04-23 19:58:33 GMT LOCATION: scanner_yyerror, scan.l:1176 2022-04-23 19:58:33 GMT STATEMENT: select 'a'::text is of (text, integer= ); I can't find anything in the changelog saying that "is of" was removed. For what it's worth, nothing in the docs ever said it existed either (though it did, as per real life). 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) =3D any(ARRAY[pg_typeof(''::text), pg_typeof(= ''::name)]); Is there anything obvious I am missing for easily resurrecting the above "is of" use ? Thanks, Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B