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 1tped6-009ils-ML for pgsql-general@arkaria.postgresql.org; Wed, 05 Mar 2025 02:37:04 +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 1tped5-00FnFc-DT for pgsql-general@arkaria.postgresql.org; Wed, 05 Mar 2025 02:37:03 +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 1tped5-00FnCT-1N for pgsql-general@lists.postgresql.org; Wed, 05 Mar 2025 02:37:03 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tped3-0011P2-0L for pgsql-general@lists.postgresql.org; Wed, 05 Mar 2025 02:37:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5252b0nl225734; Tue, 4 Mar 2025 21:37:00 -0500 From: Tom Lane To: Igor Korot cc: "pgsql-generallists.postgresql.org" Subject: Re: Error on query execution In-reply-to: References: Comments: In-reply-to Igor Korot message dated "Wed, 05 Mar 2025 01:42:13 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <225732.1741142220.1@sss.pgh.pa.us> Date: Tue, 04 Mar 2025 21:37:00 -0500 Message-ID: <225733.1741142220@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Igor Korot writes: > binaryIntVal = htonl( (uint32_t) type ); > paramValues[0] = (char *) &binaryIntVal; > paramLengths[0] = sizeof( binaryIntVal ); > paramFormats[0] = 1; You're apparently trying to pass this parameter as an int4 ... > res = PQexecParams( m_db, "SELECT * FROM abcatfmt WHERE abf_type = > $1", 1, nullptr, paramValues, paramLengths, paramFormats, 1 ); ... but given that you didn't specify any data type, I think the parser will fall back to assuming that $1 is the same type as "abf_type", whatever that is. Passing data in binary is not at all forgiving about getting the data type right. regards, tom lane