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 1tqEAe-001Vgu-RD for pgsql-general@arkaria.postgresql.org; Thu, 06 Mar 2025 16:34: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 1tqEAd-00HK3i-Hk for pgsql-general@arkaria.postgresql.org; Thu, 06 Mar 2025 16:34: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 1tqEAd-00HK3M-5H for pgsql-general@lists.postgresql.org; Thu, 06 Mar 2025 16:34:03 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tqEAb-001KmF-1R for pgsql-general@lists.postgresql.org; Thu, 06 Mar 2025 16:34:02 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-6fd719f9e0dso7416537b3.1 for ; Thu, 06 Mar 2025 08:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741278841; x=1741883641; darn=lists.postgresql.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ztRrpWIf48HL36OPN4BJDM0doNpbWBbf1us+8LvXOM0=; b=UvMkuzAtt/bsPHK681y4iVpoGGegjB6kBrt74tqVwYif2uBtxAkV2PArlKR8aMMy1r q25RtDnDrr/gkrIcfIoc3Vorrjozc0kLDVpaZSaybtci7nEfB5IVWOUFXZiinIjJV9en je0rkC7nflAkMCLieJqMS1eRo7df8OUfrPGB09QXkai0Xf1b8aIGr1vsNE7fB8ZHtDS/ OnZqLzTw6UUIXDzkK43FMBEM8iHvcFjjGQY4YLHt+hCNz2AgCouQ0fJaO9HBNnnk8fNq jk+PRsYs8E50xd7rRkElyM82gJh+GRGmR+wWxHqiYQinPkLeGZBDcxiqcKsQ1uibixmX vJwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741278841; x=1741883641; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ztRrpWIf48HL36OPN4BJDM0doNpbWBbf1us+8LvXOM0=; b=q0dJ0TjzTe3F9v2aAFbe0mxYSRiLwyDqDhBTcIWcAT8hPnGgyzQ/cEJ6FiFOSM3uDc 3rBZilOx3TQ4XuNYpjL1Y+ywbmP97ngmD6ZB8vj1v/KX/UN+mciLKeT6Q5DdmNlWtwVU qi/0Nf/aoTsT1umQ2XoEHBj/9z+4IYpjPzaJRN9Ocbd16bTA74hvWM9HkIPCbVzn1yR0 KSGQyCldRXXV4oGDbq67hb23dZCI4kTLarAIhQvWniODTRm5lAZ6LEa5Kmqm3Yb3vaXY /xwLTb1yiBmFThpZwh90/1KKADLonrL7erV934ZuF2pSZNK2vzoez5nXi75ocXbN1qCS ZEeQ== X-Forwarded-Encrypted: i=1; AJvYcCW2BGfIFQXDnlTu8ZArji9Imsn8kYaB0Tq1DNbWqFsZL+ZC+NQKznHQzIfUzF1GasyWEVVsEtYARHspgGWk@lists.postgresql.org X-Gm-Message-State: AOJu0Yx3R2q/2cMCBreuWd0C8r+9dshqVVlxQH2gZZjuwMeq6j0KWwSz EYtpMXqA2ays+BvLfHhqJljcPHOScZDLSKWuOwU1tCu3tenhmT1yfsVydCW77ACz2Y93nUhu808 cDIQae8nbAQ7Bdi5siiWiozvs/eA= X-Gm-Gg: ASbGncufQcMDkY7tY7rzcWUiH13r9yfZUzYtqjnGCOiJvryhB4m7G5KkDujOaMagc2c P2z/G2M8mkX/r2bsnL68lcAedgsNlDdmbSKJgnsZStFmym+uoFjNK5xLB+j83c/z0R+3NFPKxBg iwOyyeMS7UWKvoUcvjaasHD96Up23ynpYJkDwbjQ== X-Google-Smtp-Source: AGHT+IErb0sjtykqZe32ry+GsXF7NQ0C3FdvOvetDGl133/qckmRzrST1gUr5JWHH1u/wxj44SO8e60cjT/5MxY3eK4= X-Received: by 2002:a05:690c:3603:b0:6f9:aecf:ab34 with SMTP id 00721157ae682-6fda308d8d6mr102225497b3.38.1741278840995; Thu, 06 Mar 2025 08:34:00 -0800 (PST) MIME-Version: 1.0 References: <225733.1741142220@sss.pgh.pa.us> In-Reply-To: <225733.1741142220@sss.pgh.pa.us> From: Igor Korot Date: Thu, 6 Mar 2025 15:54:41 -0600 X-Gm-Features: AQ5f1JpWSk_4gMza7cUeZdT3Z16FYLBAMznFoty5oSVitPduvmerCMhPIFIn-Pg Message-ID: Subject: Re: Error on query execution To: Tom Lane , "pgsql-generallists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk H, On Tue, Mar 4, 2025 at 8:37=E2=80=AFPM Tom Lane wrote: > > Igor Korot writes: > > binaryIntVal =3D htonl( (uint32_t) type ); > > paramValues[0] =3D (char *) &binaryIntVal; > > paramLengths[0] =3D sizeof( binaryIntVal ); > > paramFormats[0] =3D 1; > > You're apparently trying to pass this parameter as an int4 ... > > > res =3D PQexecParams( m_db, "SELECT * FROM abcatfmt WHERE abf_type = =3D > > $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. Changing the line above to read: res =3D PQexecParams( m_db, "SELECT * FROM abcatfmt WHERE abf_type =3D $1::smallint", 1, nullptr, paramValues, paramLengths, paramFormats, 1 ); results in: $1 =3D L"ERROR: incorrect binary data format in bind parameter 1\n" I am now at a complete loss. How do I fix the code so it will run? Thank you. > > regards, tom lane