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 1u15IH-00DnXE-GX for pgsql-admin@arkaria.postgresql.org; Sat, 05 Apr 2025 15:18:49 +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 1u15IG-00EUOm-7S for pgsql-admin@arkaria.postgresql.org; Sat, 05 Apr 2025 15:18:48 +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 1u15IF-00EULM-Qj for pgsql-admin@lists.postgresql.org; Sat, 05 Apr 2025 15:18:47 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u15ID-003Yz8-1M for pgsql-admin@lists.postgresql.org; Sat, 05 Apr 2025 15:18:47 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5e6194e9d2cso5580427a12.2 for ; Sat, 05 Apr 2025 08:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1743866324; x=1744471124; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=81huFDHNH7YYlnzX85ACLbF7wv9WydjdxnPVD6nAlek=; b=pOc0JrJWMFE7vcIlkmT/u0JmhtzXyCIQhK8Bmymz2bLF8mMCzyOK/u6WFcbsfWvB1Q UfzUESkaZaGP+Lm+eqmhz+N858IgVUKUBTKngfkV0lmdFnCV+o533R1pnuk8CWBerbpa mb98B9iaSQmGLN8iZp+t0FLSbfQX0pmWB/Dbrt4Pf+5vdPjeKczbEKTIwp3ecTmi8bcB VYuiiO1zOfGGp8jSgOqaby6vkie7fpwxdhUiiexDW1ORuI/ZR5tji612FiCvDHKxsYdz TYMnyRRspr8yrdxm5OuSmFTSXvTmlV264COa0MpJKgEf9B4YVlOzwBrlkdOkczlVrzz9 OX5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743866324; x=1744471124; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=81huFDHNH7YYlnzX85ACLbF7wv9WydjdxnPVD6nAlek=; b=AD2JXZ47z4vP1SZ6OUHYmGbUiAs89yXZdSH+KlPV0/nKA3uNdmxC+V8Ful/KejfJ0U a6q7E5KjyVh+u02vsJa93F0qu/+LO1iQYgeR/a0itKlvPL8JhX5vc2lz+2sanhZ73S6C TOw7uvQyyIaqGguA4yPyanZliypkRaCBI+nlTjkZpa1AqZa3xILGRuwKGv9dTJVOavRk ABHooCvfsMjIGCs7Or+kNgv03XywdOEe4Ot7SayoPgX1aWKCySEfKbnnSZqRrEUVK/cI ctsNypfFJgqkj4QFXybSEnUYHGHN7ATsvtnqHJxq+A/WODiz7nMQVNAbXBWUoJGpdZUS I5Zg== X-Forwarded-Encrypted: i=1; AJvYcCUiV7BmXPfa35d5XUkMxeYHKegTwWXc3s62KFYh5eBJjAcaZtjxNykGPieHAXr8NyPzXpTevP/T8PDwZQ==@lists.postgresql.org X-Gm-Message-State: AOJu0Yx9V8NeEgV2tPY0756AizQEYcbKjiontwUO1f4BwBXIjiZsJ//f 68W/BVcCFkchb1Ic6BAxJu+XmBv2+0Bg6gqvqqtluOj+sMJpgZQGfoi4QAW5YBg= X-Gm-Gg: ASbGnctF0iKLbVxghR7A+8mJcWhjZk0hplsrp7KneDfL1vqHFLCFedvm39N9SYYQQj7 EmvSBNpHjI1XLxhqYxG5s2BFMoc+T5yeoxzx/KtsaTMJv8tQUFBXs5g0lEZbsEdZgB38fOWZLmf CFQDX2XH5ZCz2ysMaO+5XP6eRK4nrQ6Onj9x/9zZOYyxZdwHPxi4DsJce6zu72n1JogyOzlMgxc 1545h59gie1sZwtHfPwLrONgis3AwBWBtVkhYyoBarwh7wGVEaCFxxalRdaL03akVTKipyQtova snxqgcc5sHo55MfTsLxa3Tw+21U4Eav1elEe1S2fPpeWZnAYRLx9u2N0RqzjnbYh X-Google-Smtp-Source: AGHT+IGfN59WsRzuOTOZ6CgN5yhewCf4upKuNb21XQXoG5qa614w9T9nyvbqGuSOD8i8DMtk8GsWJg== X-Received: by 2002:a17:907:9728:b0:ac6:b853:d07f with SMTP id a640c23a62f3a-ac7d185e3c9mr563391466b.2.1743866323807; Sat, 05 Apr 2025 08:18:43 -0700 (PDT) Received: from localhost.localdomain ([2001:871:260:1a9a:2e89:ea3:a16f:fc1a]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac7bfe5d44dsm441944266b.13.2025.04.05.08.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Apr 2025 08:18:43 -0700 (PDT) Message-ID: Subject: Re: Issue with retrieving data when the column has @- in it's value From: Laurenz Albe To: Teju Jakkidi , pgsql-admin Date: Sat, 05 Apr 2025 17:18:42 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-04-04 at 18:41 -0700, Teju Jakkidi wrote: > I have an issue where in the same scenario=C2=A0below works on my POC=C2= =A0but is=C2=A0having an issue in the original db. >=20 > Original db - OS :=C2=A0Red Hat=C2=A0 =C2=A0(postgres13) > POC db - OS : SUSE=C2=A0 =C2=A0 (postgres 14) >=20 > SELECT char_length("col1"), octet_length("col1"), "col1" > FROM "test_col"=C2=A0WHERE=C2=A0"col1" =3D 'test_level@-1'; >=20 > The above query returns data in POC, however, on orig db, it does not ret= urn any data. >=20 > On orig db, I have to either a dd trim or COLLATE "C" for it to return da= ta. >=20 > The collation=C2=A0is same on both the dbs (en_US.UTF-8) and the os locat= e is also the same on both. >=20 > Column col1 datatype is varchar. >=20 > I tried checking if there are any spaces or special=C2=A0characters and d= id not see anything in the output.=C2=A0 >=20 > SELECT char_length("col1"), octet_length("col1"), length("col1"), encode(= "col1"::bytea, 'escape') > FROM "test_col"=C2=A0WHERE "col1" =3D 'test_level@-1'; >=20 > output is the same for both: > =C2=A0char_length | octet_length | length | =C2=A0 =C2=A0encode > -------------+--------------+--------+--------------- > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 13 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 13 | =C2=A0 =C2=A0 13 | test_level@-1 >=20 > Can anyone guide me on what else can be checked? Find out the primary key of the row in question and look what the bytes are= : SELECT convert_to(col1, 'UTF8') FROM test_col WHERE pkey =3D 42; Compare that on both databases, and compare it with the string literal: SELECT convert_to('test_level@-1', 'UTF8') FROM test_col WHERE pkey =3D = 42; Also, compare the collations shown in the \l output for the database. Yours, Laurenz Albe