From: Erik Wienhold <ewie@ewie.name>
To: M Sarwar <sarwarmd02@outlook.com>
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: SQL is fetching results BLANK checks but the data has no BLANKS
Date: Wed, 5 Jul 2023 23:25:59 +0200 (CEST)
Message-ID: <1539000886.854641.1688592359041@office.mailbox.org> (raw)
In-Reply-To: <DM4PR19MB597845608FD03283CC6EEB1DD32FA@DM4PR19MB5978.namprd19.prod.outlook.com>
References: <PH2P110MB0922161A06BF0F0AF502C420FF2FA@PH2P110MB0922.NAMP110.PROD.OUTLOOK.COM>
<DM4PR19MB59789AC5B76EA5829DF176E9D32FA@DM4PR19MB5978.namprd19.prod.outlook.com>
<DM4PR19MB597845608FD03283CC6EEB1DD32FA@DM4PR19MB5978.namprd19.prod.outlook.com>
> On 05/07/2023 23:10 CEST M Sarwar <sarwarmd02@outlook.com> wrote:
>
> Data in the database is uploaded using python.
>
> I have tried to test the same results by creating a sample table where I
> inserted some sample data. In my sample test, I do not see any discrepancies.
>
> ------------------------------
> From: M Sarwar <sarwarmd02@outlook.com>
> Sent: Wednesday, July 5, 2023 5:01 PM
> To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
> Subject: SQL is fetching results BLANK checks but the data has no BLANKS
>
> SELECT TEST_NUMBER
> FROM BRONX.TEST_TEST_DETAILS_ALL_MCM
> WHERE LEFT(TEST_DESCRIPTION, 1) = ' '
> ;
> The above SQL is fetching lot of data but when I take closer look at the data
> in the table TEST_TEST_DETAILS_ALL_MCM, I see no prefixed BLANKS in the column
> TEST_DESCRIPTION.
>
> test_description character varying(50) COLLATE pg_catalog."default", -- TEST_DESCRIPTION, type
>
> What could be the reason here for fetching the data when I do not have the
> data which has prefixes of BLANK , ‘ ‘.
Is there a functional index on left(test_description, 1) ? My guess is that
the index is corrupted. This can be fixed with REINDEX.
--
Erik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: ewie@ewie.name, sarwarmd02@outlook.com, pgsql-admin@lists.postgresql.org
Subject: Re: SQL is fetching results BLANK checks but the data has no BLANKS
In-Reply-To: <1539000886.854641.1688592359041@office.mailbox.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox