Re: select * from test where name like 'co_%' - Mailing list pgsql-general

From Kenneth Marshall
Subject Re: select * from test where name like 'co_%'
Date
Msg-id 20200310125428.GV32117@aart.rice.edu
Whole thread Raw
In response to Re: select * from test where name like 'co_%'  ("sivapostgres@yahoo.com" <sivapostgres@yahoo.com>)
List pgsql-general
On Tue, Mar 10, 2020 at 12:49:01PM +0000, sivapostgres@yahoo.com wrote:
> Hello,
> What returns when I run a query like this;
> Select * from test where name like 'co_%';
> I expect anything that starts with 'co_' and NOT 'co' only.  Am I right?  But I get every names that starts with
'co'.Why ?
 
> Happiness Always
> BKR Sivaprakash

Hi,

Check out the documentation:

https://www.postgresql.org/docs/12/functions-matching.html#FUNCTIONS-LIKE

You have 2 meta characters there. The '_' matches any character also.

Regards,
Ken



pgsql-general by date:

Previous
From: "sivapostgres@yahoo.com"
Date:
Subject: Re: select * from test where name like 'co_%'
Next
From: Paul Foerster
Date:
Subject: Re: select * from test where name like 'co_%'