Thread: Simple Query Doesn't Even with Data

Simple Query Doesn't Even with Data

From
Scott Macri
Date:
I have a simple database with table, "map_table", and coulmn,
"company_letters".  The database is populated and the first row
contains a value of 'abcdefg' in the company_letters column.

If I do a select * without a where clause I get the expected results. 
However, when I execute the following select statement I was astonished
to see no results come back.  

Any idea what could possibly be wrong here?  

I've verified the data a 100 times and am totally perplexed.  Thanks.

SELECT *
FROM public.map_table
WHERE company_letters = 'abcdefg';

-- 
Hacktorious



Re: Simple Query Doesn't Even with Data

From
Julien Rouhaud
Date:
Hi,

On Wed, Mar 09, 2022 at 08:40:45PM -0500, Scott Macri wrote:
>
> If I do a select * without a where clause I get the expected results.
> However, when I execute the following select statement I was astonished
> to see no results come back.
>
> SELECT *
> FROM public.map_table
> WHERE company_letters = 'abcdefg';

It looks like an index corruption, a REINDEX of that table should fix the
problem.

Did you update your system recently, which
may have updated your libc/libicu version, or replicated data over different OS
version (which could lead to the same problem)?  If yes, it's a known problem
and you have to reindex all indexes that uses collatable datatypes afterwards.

You can look at https://wiki.postgresql.org/wiki/Locale_data_changes for more
details about that problem.



Re: Simple Query Doesn't Even with Data

From
Ken Tanzer
Date:
On Thu, Mar 10, 2022 at 12:12 AM Scott Macri <Scott@bitsnbytes.io> wrote:

I've verified the data a 100 times and am totally perplexed.  Thanks.

SELECT *
FROM public.map_table
WHERE company_letters = 'abcdefg';


Not sure what kinds of verification you did, but did you check to make sure that there's no trailing whitespace?

What do you see for that row if you run this query?

SELECT company_letters,length(company_letters),company_letters='abcdefg',trim(company_letters)='abcdefg' FROM public.map_table;

 

--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.