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 1tvAAE-001Hux-E4 for pgsql-general@arkaria.postgresql.org; Thu, 20 Mar 2025 07:18:02 +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 1tvAAD-00146a-25 for pgsql-general@arkaria.postgresql.org; Thu, 20 Mar 2025 07:18:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tvAAC-00141R-7e for pgsql-general@lists.postgresql.org; Thu, 20 Mar 2025 07:18:00 +0000 Received: from mx0d-001a4c01.pphosted.com ([67.231.151.23] helo=mx0c-001a4c01.pphosted.com) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tvAA8-0004nC-24 for pgsql-general@postgresql.org; Thu, 20 Mar 2025 07:17:58 +0000 Received: from pps.filterd (m0075702.ppops.net [127.0.0.1]) by mx0d-001a4c01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52K3v6Hp022752; Thu, 20 Mar 2025 03:17:51 -0400 Received: from eur03-vi1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2113.outbound.protection.outlook.com [104.47.30.113]) by mx0d-001a4c01.pphosted.com (PPS) with ESMTPS id 45fy7ymmhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Mar 2025 03:17:51 -0400 (EDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hmtEIqpcOWuJfgzm8MBQlRzm/f2PcRr76khcOV/rY6PCbxCmQhqmDfm5w67kBB3j9d9ES7qMyY36k3+0IQLp8z9RtN5ob+G1hR8RcIx9kZ+LAjQzof5OxcvrrpywaEJ5Xwqb10i4dygL/Vg5FYKJ2PeGRowaMT3xwJ9EBED3/QGqoBMWmadz7G6DPOZmrOo5VQsl9IOI++/aorkQOQfF6iBaz0HdHmvASG18RKo8lERpKHR0d+9dl2zRN2/BmaGwhnqRnCKfkrs/t8DR4hiE1FZCxqDRsnBLrz58RNNiCYI0YaBTP120qrv8EsK3xeZxFzNnaAoq0rkKpHD48LzNOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yZ31R1IuxkUTq0wTAWToHPsPOyJ9w3jLJCwh4bsJcO8=; b=WTusQ22mrNsz3Gn2T720eVVOkeWwQUdBZj3Oze2aBY1hHW4rjEQ177ooVgkFN2MSf4B6p5x4Vpj+XmNZTYAP837HtLjcdJtevsHvZ0lR/0WTWkpTdEnU2hh4+3ZqIwpDaVFg/x7cDrPARoac/RNxrerpSD2MgN2Ce1E6oXp7bAyCzKg2lQcabwgDnd+UUxDlwt/83mvl4KeRwtXuk+tKq/YcQ8QZWUBw5NvAjuOtIhROkyG8xYDQtNUU5ZWULKlG/ubm8KL1krQ3O+bQEEDG0wdAOgTFbTLK7wQGq9NwV1lHFRz149M5n4hhf1OmkcIGiq/bqAo5cMu9tm67G/HLJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=4js.com; dmarc=pass action=none header.from=4js.com; dkim=pass header.d=4js.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ourvolaris.onmicrosoft.com; s=selector2-ourvolaris-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yZ31R1IuxkUTq0wTAWToHPsPOyJ9w3jLJCwh4bsJcO8=; b=bN6tougMbt+OtQgJMMbKqief5+zEZhD6qsPrKFCnCTeLDejxpCpqPossfNOkqeLNaxH2cNkKMPr8saOs0+8D4EDkR2WC1+vRSHOH+z7VSzjcLO/lo9FNiRYeia6zhyjsxx38angsnfb12KRkHxYpIaoEDXMsSbPr95KookVwlMo= Received: from DBAP191MB1289.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:1c9::19) by AM0P191MB0628.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:156::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.35; Thu, 20 Mar 2025 07:17:47 +0000 Received: from DBAP191MB1289.EURP191.PROD.OUTLOOK.COM ([fe80::9a60:21a1:9aa2:cdb0]) by DBAP191MB1289.EURP191.PROD.OUTLOOK.COM ([fe80::9a60:21a1:9aa2:cdb0%4]) with mapi id 15.20.8534.031; Thu, 20 Mar 2025 07:17:47 +0000 From: Sebastien Flaesch To: Tom Lane , Adrian Klaver CC: M Tarkeshwar Rao , "pgsql-general@postgresql.org" Subject: Re: After upgrading libpq, the same function(PQftype) call returns a different OID Thread-Topic: After upgrading libpq, the same function(PQftype) call returns a different OID Thread-Index: AduV23zLkRPb77LLTluClfIN9ptbAwAAUL0AAB4WV3IAeBJWgAAZCpZeABV5O4AAAQWqgAAcjkQe Date: Thu, 20 Mar 2025 07:17:47 +0000 Message-ID: References: <3498256.1742065328@sss.pgh.pa.us> <295e06b4-ff5d-4d82-ba56-1bab24be6bbc@aklaver.com> <7a07f957-bb8c-413b-806a-504a5cd12072@aklaver.com> <718368.1742404967@sss.pgh.pa.us> In-Reply-To: <718368.1742404967@sss.pgh.pa.us> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DBAP191MB1289:EE_|AM0P191MB0628:EE_ x-ms-office365-filtering-correlation-id: 9a01a447-f557-48fd-e81f-08dd677f50dd x-volarisppoutbound: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|366016|38070700018|13003099007|8096899003|7053199007; x-microsoft-antispam-message-info: =?us-ascii?Q?/lit/iL0TlhXXVkAnvNjNoSgDi5PWef9MPu/pxsyh86DTVUPR9fIKrXeGQKr?= =?us-ascii?Q?7Ooxnqyv+qu4y6MS2vZ7iG5BU19UXNdu8+7UOY4XIwVfuFgOhm6W28fwpZLq?= =?us-ascii?Q?neQLJAtthNj6OJBY0dEDWlnsKIbOt28qMdMraSL9KVW64Vs4dj6hseSDZ7/o?= =?us-ascii?Q?fRuUJLJFlltwvJqAJ/rsGPshEONmZMtNSLCifbTWcOQJmBL9vjhKxOX0xK6i?= =?us-ascii?Q?2u/n1WwX7N24p4Am0VKmRni7oIYOHIJ8ePiglZMVYH7mjj4WskpD4C4OH1d2?= =?us-ascii?Q?Sa7R0rZf1xNhRKwN7C+83zEb0J1WKYDR5g84N9ohqJhei/9u2uR4tDgtCEPb?= =?us-ascii?Q?BSMw2qFiIT+PUHeC6dqwIuJwFAp6EUdoIoitvHKCGZ/mW+tu2NdpuOVKzQTH?= =?us-ascii?Q?/QGEwbatKOpesgcxBDNTyw8g0m/sSH4xVxVGAW+eHh6gkxSHEK3m/+aQL/eF?= =?us-ascii?Q?+Mq6gp8BwDCBOEQFupEn27dzu8Qp+ip78pQZzsucUfhK0Fn3xOW1nZopd+1A?= =?us-ascii?Q?0vA9liKfJKb2O9jK9ZfgLQRJqe558iXOdwMnVzvnFipBncmwUmswapiiOv8B?= =?us-ascii?Q?XvQEFVev1eUCgGpIDjRbccFxtN4dD6RgCvWoR/hyrKXSSecFtYdti50YFm+U?= =?us-ascii?Q?TLDmxmheSBiosJMiOW3QixO7tkpoztXiybvzmZUnV6RK7vorn8ajt0hy6QpM?= =?us-ascii?Q?LNd4HLbqf+NaRLzYA2+Z1Hp1hnSkxFEmF0WCt52oKARbX/0xfV7N9S65WwMB?= =?us-ascii?Q?Z9yVBK0FnK0MHvotuJsZlRwURfV0LPDZ8YIHSj3qqKjLh5coDNlz0A+/BR7f?= =?us-ascii?Q?ZmWVN7kDTLrIg4QBVQ6fwFRbLdpEzvSmVFxXISrRhtJDo4PqQyx3MdoDdK2e?= =?us-ascii?Q?tUlBHHdkG6r6+zh9/a4jxi8W3NHxxbjjOCaMujxWCpc+sOWAaaeh3TyD51rR?= =?us-ascii?Q?2gLa38VpRayoro/APHZ/fTIMw1+VYhZ2FRM+KDTxQcnjCaTxjFcEecl30GV+?= =?us-ascii?Q?HtxBqth39JiNT6E7BYBS+SoQVftuiSh0/ZmxLc9lkQ3o3yoAMCWJ179i5tDH?= =?us-ascii?Q?F2Z1HpDLMlTQ7jm5Suz7adZteoRlaw6cYkGEoJ6tYcqOIrbrwCHu9qt/kPad?= =?us-ascii?Q?0LvsroAWLZ2M3hzYGLB81Ahwa8uifrjCFTXV18jzTbUQdH6AIHP7vUW2fyx/?= =?us-ascii?Q?g6gzrtXIjXEjQcEP0atoS7Xro+HfqZ2VDtF6g0RKRv0oxO+gJlotYwWAghDw?= =?us-ascii?Q?UU44k73BDLZNT2EK9wsAcfYl5lvkxfCN3ZQ948ab6KXDaEEFYc0Xw21AD9qr?= =?us-ascii?Q?DbnSlx2sEyUPhI1rtC51lf+pQ6z/H2siSQpXGMTwuIbtI0ujVk6jkTjd8E9q?= =?us-ascii?Q?9Az6Jcco0wwwv8cx0E7d59ipChuObya3kw70RrEAJks0QvNbxfAA+vRGNacg?= =?us-ascii?Q?jUqSa/RSJNGvNJKmiWptBGWbs5EZHf5P?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBAP191MB1289.EURP191.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(38070700018)(13003099007)(8096899003)(7053199007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BDY5J+ke8xC2HAdehHyCQgS63H5OSz8VVUfUaUMCMunKnlL1jiwVVYmrNzDf?= =?us-ascii?Q?EtM+YWkJyKvCTEhxSSn+VhpMcpptLMgy0Az+uTDysntH7WV5GFi7Z/jRQaX6?= =?us-ascii?Q?y7UyZ7bzBTg8vk1W5zZU/fDiV7KwCpk1O5I8Oz5hlcY0/Bp5bE+5I8fj+Sab?= =?us-ascii?Q?SlxOkK7dX+2m4Gb4Bv2z/vCuNhz3PAGbfVD6YkX525Dm26c6fD1lwAqonc0M?= =?us-ascii?Q?cpQdUNg7mCsawa2hRyiSKhDGuNFOpebEzJTPVbZ8ymfHfCWAZXC9lFfWdA4q?= =?us-ascii?Q?NMehboZVGgCyoSedwb/v7lWb0RG1zfXmypraK+V+MSU8bHqvjXyqyfZIDURl?= =?us-ascii?Q?FPrRJergj/xWJdZywH2sj/Ch54ne6UDepczZM2TyzZ9+sbk8l4kBh376Psct?= =?us-ascii?Q?AKQeAKXq8bLCaLjOt+aVloh135uyak3v2AOMjNCrV+C5AhgJZuNYquAyN+/z?= =?us-ascii?Q?cDXBogTzQjsbrV/xdAA2lPKYT68LWipesB6cTwt80ukVzsgrFBL0fu9r5GY2?= =?us-ascii?Q?qJLQhbkutZ92uXOvjOfhlwuGY9HHoe8kC5ruQvRVfuBRIO/DxeF8nlc3yhRC?= =?us-ascii?Q?egBZeZOkCj5GpixDkCXbdkzbTpT0kxuy/LKTqOECu/70Cq14dfE/LEsStWD6?= =?us-ascii?Q?iIqyWD2r2yGPxpcWykyh42sMD6fnhitUDQ39WvR6xXU/mkngAc/pAoZASa3n?= =?us-ascii?Q?tj1h1di1pXQoUocN68wLD7h4yXR2X0+W8qSbtq07waQVCyI4vDX203Qi+wA3?= =?us-ascii?Q?O5qPDtfwl7GwatusLdSxEYPuNhhQXKsyOmF5M3/SzQWRyXhvkRuXJ/s+gx8M?= =?us-ascii?Q?uL7D+b7n7Wsv6qR7vyh5EcZAzFThFQw1F5dn8pBRXHH8/5JXJSDbZTmQ2Q+C?= =?us-ascii?Q?GyuslMfi27sXFJ14UEDvKu/zZ1JNx/Aw1ZfhtC61tNf9FNLexbfX4l4WH/Jj?= =?us-ascii?Q?89/YcmeCRpsM6JVaeTvQ27VSRiriOyjriw+FuyBAugo9R3jQZz7GXGzwwHhi?= =?us-ascii?Q?ri4oeHodAi1kT2Yzh4/O0jv/e456Tin0PTBeTQCr18CnRvKPdUhOpcPBkf2m?= =?us-ascii?Q?DcmxqdC7Cj8cgxxYi44A31/F9YUzejJpAmomAM6mfB/xmt1dmgw2+T6JauDh?= =?us-ascii?Q?iArLGA+Svchp7Xil/iW2vdRKaUq6AJE8zuaTk0G2ZrPsw1sU9nVwk3rzkkOP?= =?us-ascii?Q?LJK308APQX+DZeaiiS0ssWNQZfvT8/O/Wub/Z3jRnHPySBs95Yw5iTHkVzrO?= =?us-ascii?Q?95LCdEYlr0HY4ioBdltCl4eLjEisy5IB8xbUiFC22dvcrur+yEtU2BDp435U?= =?us-ascii?Q?9XVECaWEnJZ+ry9F6ELj4vm7T/c73wjzOiB9R2DTn7klEQjmzuUxMjX8cdnz?= =?us-ascii?Q?prNNw3qGX47CZgUh1+wzg3tnohh+rT10Qhig+ZEiLe4Rexh/q+JudZGnTINY?= =?us-ascii?Q?3bWV1D/tJGc2tpWq8AnbWHVJzaUH+Z7/Q2ODcKizYBR2cJzRMTBvsAhxhcis?= =?us-ascii?Q?7xUnUzjPcdf/uQp36dHSfToGSv8T3T27IEsNCBzDig12kQ4SGnEbMl2X8a8Z?= =?us-ascii?Q?4W7nURN+Wrqh/3HtyCrt4xYBk1PMg4CCTANAtVIh?= Content-Type: multipart/alternative; boundary="_000_DBAP191MB1289417EA192457D9663350EB0D82DBAP191MB1289EURP_" MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nhqyewnSuzPigaM39RMmi2L5OOTyNIs7HRa1gjDs2hNLnfeulO8rcZWVarHK4O7lZ5egxtZIOjP1UM+iLV6zTSLiBAU8etJA0lT5z7nR+Jdw2gNMuhgM7e8F0NmWK8b0LSomZ+pvyBXSJE6VcqRtQg0x9YIX8E4K/BqNmgMOhG+sGYyFr3R7d4DZb5aMragTGd3lWLruOURw/INSV+31LmLL7X6VNQ2WXLy6avIMIiKHiuo5lPIwYqi7h0vqVbXG1oReild0oK/05hMT/APBbRDSxZsi4WRHf4b2trbwkN/o9dmLMxc29XJ8Q9CYoy1LDv1xAUXK7PbOoc4kflPrcNkjQn5wmjPy9ptb2EaLGA9EUOrMTqDgTUX3dPZsaWtL7sWvy3gRgOu7v9z6OEA4aGLj5C/p6/T2jmI621EmoqUSmzpNB0mMubhTspruJzoWwwS4bAh9RZsteCdV50SLF43aeOSqs5XBlOSeZ9L/faI6BwxQszcWeZB1/nZy93BkGoB6nqnrnHalaSm2/tFNLM/SbKgg26X78Oe9Zr8d3Oses/uLICaVSUKvw8ymyIjMl1diSs9LJOVF+qYQIZ3f7Y11Lk5jmaIxYiEmcSB0g36eYnrDwrDt01NVSda+O7nSe4gQr5EBngXUns/YwJtq/g== X-OriginatorOrg: 4js.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBAP191MB1289.EURP191.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 9a01a447-f557-48fd-e81f-08dd677f50dd X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2025 07:17:47.1225 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 75c696ec-5bfb-4892-9a0c-9187a9061cd6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: I2Ruc2lA/gfNkOhbJw+VGDL6lif2wjyCFKUJBECZIqAsfm4pZLR7aaWYHT6OTedXHReKbKRK3OymHe0XwSJKc5Nno/2TqeM+hTr+CCT1+8c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P191MB0628 X-Authority-Analysis: v=2.4 cv=db6A3WXe c=1 sm=1 tr=0 ts=67dbc11f cx=c_pps a=M0ofR1SZsE9Aqv11TW0x/g==:117 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Vs1iUdzkB0EA:10 a=H5OGdu5hBBwA:10 a=udrfY5dcTTYA:10 a=epTmVMiNAAAA:8 a=SNL7wKpgAAAA:8 a=YiSXs9CjAAAA:8 a=0FD05c-RAAAA:8 a=nUW6CPU10pqNngXC5CUA:9 a=CjuIK1q_8ugA:10 a=z_lyT-gtfX8A:10 a=LdI3zkpMCeUA:10 a=w6Nfrg84F-DCAJmEW_oA:9 a=Hd3DS1CAmzQk-b5w:21 a=frz4AuCg-hUA:10 a=_W_S_7VecoQA:10 a=uEXi9pYaZPHPrIM342IW:22 a=i3Kcs0zRCnBKJ3xysGeB:22 a=l1rpMCqCXRGZwUSuRcM3:22 X-Proofpoint-GUID: xFIKvFV1ARsxCwMo161CN0ImFwKU1zrq X-Proofpoint-ORIG-GUID: xFIKvFV1ARsxCwMo161CN0ImFwKU1zrq X-ProofpointHeader: Yes X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2502280000 definitions=main-2503200043 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_DBAP191MB1289417EA192457D9663350EB0D82DBAP191MB1289EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Let's not deviate from my request: I have implemented various DB client modules using the C client APIs, for O= racle DB, SQL Server, IBM DB2, MySQL/MariaDB, SQLite and PostgreSQL. While I like PostgreSQL a lot, this is the only case where I have to define= myself the column type ids, to implement a "describe column" feature. ODBC has SQLDescribeCol() / SQLDescribeColW() and predefined SQL_* constant= s like SQL_INTEGER, SQL_VARCHAR ... Native PostgreSQL built-in SQL types should be listed in a .h header of the= C client API I do not want to execute SQL to identify a column type returned by PQftype(= ). This is not efficient, even if I would cache the mapping of the type oid to= a type name. I just want to do this: static int prepareField(SqlStatement *st, int i) { int pgftype =3D PQftype(st->pgResult, i); int pgfmod =3D PQfmod(st->pgResult, i); ... switch (pgftype) { case PG_TYPE_BOOL: ... break; case PG_TYPE_CHAR: case PG_TYPE_BPCHAR: case PG_TYPE_VARCHAR: ... break; And today I have to define all these type ids: /* ! Should be provided by a PostgreSQL header file! */ #define PG_TYPE_BOOL 16 #define PG_TYPE_BYTEA 17 #define PG_TYPE_CHAR 18 #define PG_TYPE_NAME 19 #define PG_TYPE_INT8 20 #define PG_TYPE_INT2 21 #define PG_TYPE_INT2VECTOR 22 #define PG_TYPE_INT4 23 #define PG_TYPE_REGPROC 24 #define PG_TYPE_TEXT 25 #define PG_TYPE_OID 26 #define PG_TYPE_TID 27 #define PG_TYPE_XID 28 #define PG_TYPE_CID 29 ... I don't care if this list is generated when building PostgreSQL from source= s. I expect however that the type oids for built-in types remain the same fore= ver. Seb ________________________________ From: Tom Lane Sent: Wednesday, March 19, 2025 6:22 PM To: Adrian Klaver Cc: Sebastien Flaesch ; M Tarkeshwar Rao ; pgsql-general@postgresql.org Subject: Re: After upgrading libpq, the same function(PQftype) call returns= a different OID EXTERNAL: Do not click links or open attachments if you do not recognize th= e sender. Adrian Klaver writes: > On 3/18/25 23:41, Sebastien Flaesch wrote: >> I was not expecting this file to be in a "server" folder, when it's to >> be used for client apps. > Not surprising. As I understand it this is the code used to build the > type entries in the system catalog pg_type. More the other way around: pg_type_d.h is built from the authoritative source files pg_type.h and pg_type.dat, according to the process described here: https://urldefense.com/v3/__https://www.postgresql.org/docs/devel/bki.html_= _;!!I_DbfM1H!GM5pJKRPNVArTRiyYGhyIZrVAgLo7RZl1FSS5kG4IZvWLW75bP4zu1P7yVuLuc= Hd3_FbuKym1-W3Wv0iEs6X$ >> And still, I do not trust the content. Why not? If it's the "Backwards compatibility" comment that's bothering you, a look at pg_type.h will show you that that's only intended to apply to the CASHOID and LSNOID symbols. Everything below that in pg_type_d.h is machine-generated. regards, tom lane --_000_DBAP191MB1289417EA192457D9663350EB0D82DBAP191MB1289EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Let's not deviate from my request:

I have implemented various DB client modules using the C client APIs, for O= racle DB, SQL Server, IBM DB2, MySQL/MariaDB, SQLite and PostgreSQL.

While I like PostgreSQL a lot, this is the only case where I have to define= myself the column type ids, to implement a "describe column" fea= ture.

ODBC has SQLDescribeCol() / SQLDescribeColW() and predefined SQL_* constant= s like SQL_INTEGER, SQL_VARCHAR ...

Native PostgreSQL built-in SQL types should be listed in a .h header of the= C client API

I do not want to execute SQL to identify a co= lumn type returned by PQftype().
This is not efficient, even if I would cache the mapping of the type oid to= a type name.

I just want to do this:

static int prepareField(SqlStatement *st, int i)
{
    int pgftype =3D PQftype(st->pgResult, i);
    int pgfmod =3D PQfmod(st->pgResult, i);
    ...
    switch (pgftype) {
    case PG_TYPE_BOOL:
        ...
        break;
    case PG_TYPE_CHAR:
    case PG_TYPE_BPCHAR:
    case PG_TYPE_VARCHAR:
        ...
        break;

And today I have to define all these type ids= :

/* ! Should be provided by a PostgreSQL header file! */
#define PG_TYPE_BOOL                = ;      16
#define PG_TYPE_BYTEA               &nbs= p;     17
#define PG_TYPE_CHAR                = ;      18
#define PG_TYPE_NAME                = ;      19
#define PG_TYPE_INT8                = ;      20
#define PG_TYPE_INT2                = ;      21
#define PG_TYPE_INT2VECTOR              =  22
#define PG_TYPE_INT4                = ;      23
#define PG_TYPE_REGPROC               &n= bsp;   24
#define PG_TYPE_TEXT                = ;      25
#define PG_TYPE_OID                =       26
#define PG_TYPE_TID                =       27
#define PG_TYPE_XID                =       28
#define PG_TYPE_CID                =       29
...

I don't care if this list is generated when b= uilding PostgreSQL from sources.

I expect however that the type oids for built= -in types remain the same forever.

Seb

From: Tom Lane <tgl@sss.= pgh.pa.us>
Sent: Wednesday, March 19, 2025 6:22 PM
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Sebastien Flaesch <sebastien.flaesch@4js.com>; M Tarkeshwa= r Rao <m.tarkeshwar.rao@ericsson.com>; pgsql-general@postgresql.org &= lt;pgsql-general@postgresql.org>
Subject: Re: After upgrading libpq, the same function(PQftype) call = returns a different OID
 
EXTERNAL: Do not click links or open attachments i= f you do not recognize the sender.

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 3/18/25 23:41, Sebastien Flaesch wrote:
>> I was not expecting this file to be in a "server" folder= , when it's to
>> be used for client apps.

> Not surprising. As I understand it this is the code used to build the<= br> > type entries in the system catalog pg_type.

More the other way around: pg_type_d.h is built from the authoritative
source files pg_type.h and pg_type.dat, according to the process
described here:

https://urldefense.com/v3/__https://www= .postgresql.org/docs/devel/bki.html__;!!I_DbfM1H!GM5pJKRPNVArTRiyYGhyIZrVAg= Lo7RZl1FSS5kG4IZvWLW75bP4zu1P7yVuLucHd3_FbuKym1-W3Wv0iEs6X$

>> And still, I do not trust the content.

Why not?  If it's the "Backwards compatibility" comment that= 's
bothering you, a look at pg_type.h will show you that that's
only intended to apply to the CASHOID and LSNOID symbols.
Everything below that in pg_type_d.h is machine-generated.

            &nb= sp;           regards, to= m lane
--_000_DBAP191MB1289417EA192457D9663350EB0D82DBAP191MB1289EURP_--