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 1tpssW-00DiFc-1F for pgsql-general@arkaria.postgresql.org; Wed, 05 Mar 2025 17:49:56 +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 1tpssU-000LiE-0v for pgsql-general@arkaria.postgresql.org; Wed, 05 Mar 2025 17:49:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpssT-000Li6-JP for pgsql-general@lists.postgresql.org; Wed, 05 Mar 2025 17:49:53 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tpssQ-0018yo-0p for pgsql-general@lists.postgresql.org; Wed, 05 Mar 2025 17:49:53 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-6fd2587d059so44026947b3.3 for ; Wed, 05 Mar 2025 09:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741196990; x=1741801790; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JhPpY3QmI377/RyHwl0dUUdcXJc3r+e4cIgiVOIPPI0=; b=kD9dVhSpXJusRMIaoMIXfvhBKEn8tcwdxiBzGMaMQbILycB9AIjNW2ft69tB++wU8x N7cKYGGAwBo++ewI5PITOu447LboRPEeot9pNYWwFTfVWw9D9fj7vKrjFjxDcvbjb2hG QXoPfqLQL9mDjhxNqDQ+FK8Y5x6yxOSjzN2Vd39zLaxQ28VC7BhhtYRfAsziAi/pBZNf A1tTMDn7c9+DigHTnS8dkNIkNEthiiV5qvPPDfynWK+s6UfYn02i3tG/z5bTlTMzl4E7 F7Znk5JQr0bSGTqgRtKw9fJMhMO+Bivutqu8IQ81wPhvd64WyVyhx+CmfeLyNNqHSkMZ U3Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741196990; x=1741801790; h=content-transfer-encoding:cc: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=JhPpY3QmI377/RyHwl0dUUdcXJc3r+e4cIgiVOIPPI0=; b=UZYqxT/Qi8nYntZzUHKwMI+XUpmvy/wf6JFDgwH4/MTSmyTPfUkkdSw5yo/GroSiRM fD1WppQyy1jLVXd4l8MYYo5wVBn5gRjX2sfpBBjyXH8AesEplaSzTbD1jR/DuS58jetN X/LHcX8xr7DST2BFF+de/ku/mmhlxuP0jFBdJCP/mmvrK0uPAzdgvxV/72eqj3GjFlya 3SqyjDc8N/hAMJUV3ON5aAW4UphoPpt+sX10lyWACqJvA0YwvVy4ZtHYALTF2/06Wzqg 430vDYq9FKbCUqUH2nfK9hmrg0i4N12tknNiGxJLSUCoPqDYTko1O5EEHRgHgVS4w5hH GSTg== X-Gm-Message-State: AOJu0YxMQhVdqGQq3nWLf7sSDHZqYpn2vBgZWzvvFVXlgxfScplU8IEs bO4wmhP+LtmifWOMff2FmvA9us5uCqtPtanINTemJuwu3FKAaUWelE/dmFJI1jFWC0kuWoCppfw IzLF2IF/lY1+wg0705ERSX68kITk= X-Gm-Gg: ASbGncvVxkjM1pgAOFDLmJPXhvmTzbf8LY1+BkzbnFwCdKBoezCQ8Xx1bg3wEgj6/1u qw/I4aeeTVJiE/twTU6dtY/pECY4hinBFO9FKG+rD7wl1GbOfyxNfy3ZH8CcMaFu043HQhXBvJM LwtpIwDbpnxajMRYbaQLe53xFsV8x/AOQoeupJMg== X-Google-Smtp-Source: AGHT+IF2P7pttbseutSSlfShRjNXFDzm0QeBH6mRZ5UKdQKIXEch7gwS2c1jPw3kmlLZmKY7Vlnmczhyq5HOLdpkb3c= X-Received: by 2002:a05:690c:b87:b0:6f9:50aa:b7e2 with SMTP id 00721157ae682-6fda30376eemr52427557b3.21.1741196989752; Wed, 05 Mar 2025 09:49:49 -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: Wed, 5 Mar 2025 17:10:30 -0600 X-Gm-Features: AQ5f1JqqARRovzpPhCgZNDjt-3xPFlomGyHvYKccj6tWnlxMq2nHW4YJwWroyqE Message-ID: Subject: Re: Error on query execution To: Tom Lane Cc: "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 Hi, Tom, 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. abf_type is declared as smallnt: queries.push_back( L"CREATE TABLE IF NOT EXISTS abcatfmt(abf_name char(30) NOT NULL, abf_frmt char(254), abf_type smallint, abf_cntr integer, PRIMARY KEY( abf_name ));" ); Thank you. > > regards, tom lane