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 1l6ccD-0003Bi-B4 for pgsql-general@arkaria.postgresql.org; Mon, 01 Feb 2021 17:03:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6ccC-0006rV-9j for pgsql-general@arkaria.postgresql.org; Mon, 01 Feb 2021 17:03:52 +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 1l6ccB-0006rO-Vf for pgsql-general@lists.postgresql.org; Mon, 01 Feb 2021 17:03:52 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l6cc9-00064f-DO for pgsql-general@lists.postgresql.org; Mon, 01 Feb 2021 17:03:51 +0000 Received: by mail-ed1-x534.google.com with SMTP id s11so19734523edd.5 for ; Mon, 01 Feb 2021 09:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=nE73sqxXW6cM3rjgceWcVjiqb/mbZAZzJ+PZ3bfehVo=; b=CKk4/wyzhV5HrR2MVbp+pHo8jMsCpUdExFLYI1lLDcT4HMqMlXy616MXYbq8yNlupC N+v8L+3RvQxxW+qGFTVy0HaP/11KDN8mZYWZ66PTDqfl4iyBXJHztF9U51GneKa3o/J8 2vpoI9P7FDZNSAvJLs4EhWZTi34XrME2EpwsNgMYFpCUG3NtEpv8iXGgDF8Og1Qjxsbb uhldSaUxhmAAhn6KjmjiNPabkK3gdOWalIXLAMpphOqtqXCSorIIzo+ikmngqb1coidi g2D1GQIq8dvEH92wp+z2XeLBL562JmDokE1FavJ2uO+3uOY48g6nfcyxN+KXwicwCu1x hwQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=nE73sqxXW6cM3rjgceWcVjiqb/mbZAZzJ+PZ3bfehVo=; b=O2fO10/c0eMp19xS3vnK0D/v7ec/fL1vAboLq718sGf5aA6xooJL6J/QSw1XGiYlld tIp2IaXnOb1YiEfTjWO4T1+I6sbGPzci44MMQxfUBXnUe8r8NY62UmDMzfkciV/A8ja/ t3iO8sVAr9Jps0dd7nV2bEdTetkC7o4qebONIlFpORQQqP6T+KFULUS4E+U8QELD3/7J bH969hSuocuF6/FTEMr8UmZEvKWfQFU8hZ+uLdav1PGpfUdSdjHE2rAmq6FTmFraqdXt IFCjDrZhUKYGsl/fqjc0h1NZvHMZdvSgmmROc31JOchGR+yi571S7uQOJsMGmRZBV+ai i6cA== X-Gm-Message-State: AOAM530UcXact2cFk7v8YAU6NdaAenmaDC6e/sNT//b37Gjczk/AExCJ fmN19ER0novOmCi5n+whjxw/IS3kQSXJ+w== X-Google-Smtp-Source: ABdhPJxyPvGGz4oxDIcrn9+fE5bOKJoUhBGk5HwNRzzbtGyynF7AIXEDiMhn5HFS2HL8yGfLSo5NjQ== X-Received: by 2002:a05:6402:3487:: with SMTP id v7mr20113128edc.68.1612199026670; Mon, 01 Feb 2021 09:03:46 -0800 (PST) Received: from [192.168.0.120] (ip-86-49-71-172.net.upcbroadband.cz. [86.49.71.172]) by smtp.gmail.com with ESMTPSA id lg21sm8261514ejb.91.2021.02.01.09.03.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Feb 2021 09:03:46 -0800 (PST) Sender: =?UTF-8?B?amnFmcOt?= Subject: Re: libpq and mysterious "invalid byte sequence for encoding UTF8". To: Tom Lane Cc: pgsql-general@lists.postgresql.org References: <8b88f867-d0d0-6deb-8f13-48853a57080a@pavlovsky.eu> <3335118.1612191322@sss.pgh.pa.us> From: =?UTF-8?B?SmnFmcOtIFBhdmxvdnNrw70=?= Message-ID: <8c67bf16-e267-a40c-25da-ebc646d0753d@pavlovsky.eu> Date: Mon, 1 Feb 2021 18:03:44 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <3335118.1612191322@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01.02.2021 15:55, Tom Lane wrote: > =?UTF-8?B?SmnFmcOtIFBhdmxvdnNrw70=?= writes: >>     Jan 26 08:40:57 ip-172-16-10-94 postgres[11334]: [113-1] 2021-01-26 >> 09:40:57.505 CET [11334] jira@project-syndicate LOG:  execute : >> >>         UPDATE contacts SET Pos = $1::varchar, Title = $2::varchar, >> PaperID = $3::int, FirstName = $4::varchar, LastName = $5::varchar, Func >> = $6::varchar, Tel1 = $7::text, Fax1 = $8::text, Email1 = $9::varchar, >> Tel2 = $10::text, Fax2 = $11::text, Email2 = $12::varchar, MainContact = >> $13::boolean, PublDataContact = $14::boolean, InvContact = $15::boolean >> WHERE ContactID = $16::int >>         Jan 26 08:40:57 ip-172-16-10-94 postgres[11334]: [113-2] >> 2021-01-26 09:40:57.505 CET [11334] jira@project-syndicate DETAIL: >> parameters: $1 = NULL, $2 = NULL, $3 = '1702', $4 = NULL, $5 = NULL, $6 >> = NULL, $7 = NULL, $8 = NULL, $9 = NULL, $10 = NULL, $11 = NULL, $12 = >> NULL, $13 = NULL, $14 =  NULL, $15 = NULL, $16 = '14340' >>         Jan 26 08:40:57 ip-172-16-10-94 postgres[11334]: [114-1] >> 2021-01-26 09:40:57.544 CET [11334] jira@project-syndicate ERROR: >> invalid byte sequence for encoding "UTF8": 0x80 > This log entry shows that your query text and parameters all made it to > the backend just fine. So I don't think your issue is on the client side. > I'm wondering if the error could be from (say) triggers doing fancy data > manipulations. Noting your use of ON UPDATE CASCADE, it'd be worth > checking indirectly-affected tables as well. > > regards, tom lane Thanks for the answer. I don't think triggers or constraints are the issue. The exact same code works if I create a small test program with the same query and the same parameters. But when used in the context of the whole application it gives the error.  I don't know what should I try. I tried all possible combinations of parameters. I have just even tried to disable triggers and remove any constraints from the table. Same error.