Re: Like Command returning wrong result set

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andreas Joseph Krogh <andreas(at)visena(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Like Command returning wrong result set
Date: 2021-08-05 14:05:07
Message-ID: CAFj8pRD1BFY=kBQvVkwkssvzaEzYSYhiqxvU3Keesg=u8j-gvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

čt 5. 8. 2021 v 16:04 odesílatel Andreas Joseph Krogh <andreas(at)visena(dot)com>
napsal:

> På torsdag 05. august 2021 kl. 16:00:38, skrev Tchouante, Merlin <
> mtchouan(at)umaryland(dot)edu>:
>
> Hello group,
>
>
>
> I’m writing a script and a bit confused on the results with the like
> command.
>
>
>
> gm.title *like* 'CP_%'
>
>
>
> The above command gives me records with titles like CP_40, CP_2, CP_23,
> etc.
>
>
>
> gm.title *like* '%_CT'
>
>
>
> The above command give me records with tiles like Quiz:
> RadiInterpretation w/ CBCT.
>
>
>
> I was expecting it to return titles that contained *_CT, i.e. FX_CT or
> DR_CT. It’s as if it’s ignoring the underscore the way it would do if you
> were using ‘%CT’. Does it ignore the underscore when it’s right after the
> ‘%’?
>
>
>
> - Percent sign ( %) matches any sequence of zero or more characters.
> - Underscore sign ( _) matches any single character.
>
>
yes

https://www.postgresql.org/docs/current/functions-matching.html

Regards

Pavel

>
>
> --
> *Andreas Joseph Krogh*
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christophe Pettus 2021-08-05 14:05:13 Re: Like Command returning wrong result set
Previous Message Andreas Joseph Krogh 2021-08-05 14:04:24 Sv: Like Command returning wrong result set