pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Query using 'LIKE' returns empty set
3+ messages / 3 participants
[nested] [flat]

* Query using 'LIKE' returns empty set
@ 2019-08-29 16:39 Rich Shepard <rshepard@appl-ecosys.com>
  2019-08-29 16:58 ` Re: Query using 'LIKE' returns empty set Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rich Shepard @ 2019-08-29 16:39 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Next problem is one I've not before encountered.

The .sql file used to import data to the fish_counts table has rows such as
this one:

('1237796458250','0','17174','Buchanan Creek','Buchanan Creek trib to North
Fork Nehalem River','0-3.25','161980','Unknown','Jack or subadult','Peak
live & dead fish','Spawner Counts','ODFW','2012-01-06','1950-1974',25,
'1950-10-01','1951-01-31','Ground','Actual Physical Counts',0), 
[Lines wrapped in the message only.]

When I submit this query I get no rows returned:

select * from fish_counts where stream_tribs ilike 'Nehalem';
  count_id | loc_id | downstream | upstream | stream_name | stream_tribs | r
iver_miles | itis_tsn | production | life_stage | count_type | data_categor
y | compiled_by | updated | years | nbr_observations | begin_date | end_dat
e | sample_method | calc_method | count_value 
----------+--------+------------+----------+-------------+--------------+--
-----------+----------+------------+------------+------------+-------------
--+-------------+---------+-------+------------------+------------+--------
--+---------------+-------------+-------------
(0 rows)

What is equally puzzling is when I search the input file using
 	grep -c -e "Nehalem" fish_counts
0 is returned, the same as the postgres query.

I want to understand what I've done incorrectly.

TIA,

Rich





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Query using 'LIKE' returns empty set
  2019-08-29 16:39 Query using 'LIKE' returns empty set Rich Shepard <rshepard@appl-ecosys.com>
@ 2019-08-29 16:58 ` Rob Sargent <robjsargent@gmail.com>
  2019-08-29 17:04   ` Re: Query using 'LIKE' returns empty set Michael Lewis <mlewis@entrata.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rob Sargent @ 2019-08-29 16:58 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


On 8/29/19 10:39 AM, Rich Shepard wrote:
> Next problem is one I've not before encountered.
>
> The .sql file used to import data to the fish_counts table has rows 
> such as
> this one:
>
> ('1237796458250','0','17174','Buchanan Creek','Buchanan Creek trib to 
> North
> Fork Nehalem River','0-3.25','161980','Unknown','Jack or subadult','Peak
> live & dead fish','Spawner Counts','ODFW','2012-01-06','1950-1974',25,
> '1950-10-01','1951-01-31','Ground','Actual Physical Counts',0), [Lines 
> wrapped in the message only.]
>
> When I submit this query I get no rows returned:
>
> select * from fish_counts where stream_tribs ilike 'Nehalem';
>  count_id | loc_id | downstream | upstream | stream_name | 
> stream_tribs | r
> iver_miles | itis_tsn | production | life_stage | count_type | 
> data_categor
> y | compiled_by | updated | years | nbr_observations | begin_date | 
> end_dat
> e | sample_method | calc_method | count_value 
> ----------+--------+------------+----------+-------------+--------------+--
> -----------+----------+------------+------------+------------+------------- 
>
> --+-------------+---------+-------+------------------+------------+-------- 
>
> --+---------------+-------------+-------------
> (0 rows)
>
> What is equally puzzling is when I search the input file using
>     grep -c -e "Nehalem" fish_counts
> 0 is returned, the same as the postgres query.
>
> I want to understand what I've done incorrectly.
>
> TIA,
>
> Rich
>
>
Are you sure that particular file has the search string?

grep -i nehalem fish_counts






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Query using 'LIKE' returns empty set
  2019-08-29 16:39 Query using 'LIKE' returns empty set Rich Shepard <rshepard@appl-ecosys.com>
  2019-08-29 16:58 ` Re: Query using 'LIKE' returns empty set Rob Sargent <robjsargent@gmail.com>
@ 2019-08-29 17:04   ` Michael Lewis <mlewis@entrata.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Lewis @ 2019-08-29 17:04 UTC (permalink / raw)
  To: Rob Sargent <robjsargent@gmail.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>

You need the wildcard character at front and back.

select * from fish_counts where stream_tribs ilike '*%*Nehalem*%*';

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-08-29 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 16:39 Query using 'LIKE' returns empty set Rich Shepard <rshepard@appl-ecosys.com>
2019-08-29 16:58 ` Rob Sargent <robjsargent@gmail.com>
2019-08-29 17:04   ` Michael Lewis <mlewis@entrata.com>

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