pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18438: regex isnt working for "^" , ".*"
2+ messages / 2 participants
[nested] [flat]

* BUG #18438: regex isnt working for "^" , ".*"
@ 2024-04-15 19:49 PG Bug reporting form <noreply@postgresql.org>
  2024-04-15 21:00 ` Re: BUG #18438: regex isnt working for "^" , ".*" David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2024-04-15 19:49 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: ankurawesome37@gmail.com

The following bug has been logged on the website:

Bug reference:      18438
Logged by:          Ankur Kumar
Email address:      ankurawesome37@gmail.com
PostgreSQL version: 14.5
Operating system:   macos ventura version 13.5
Description:        

hey , i am getting empty query result while using postgres regex operator
"^" , ".*" etc . I am able to use "%" correctly but not getting any response
for  other regex operator . For example - There is a user in users table
with  >  first_name - "aman", last_name -  "kumar" .
But while quering  i am not getting any result while querying users table
->

1) SELECT id from users where concat(users.first_name, ' ', users.last_name)
ILIKE '^am' 
2) SELECT id from users where concat(users.first_name, ' ', users.last_name)
ILIKE 'am.*' 
3) SELECT id from users where concat(users.first_name, ' ', users.last_name)
ILIKE '^am%' 

Above queries didnt return any result 

But it works for this query -

SELECT id from users where concat(users.first_name, ' ', users.last_name)
ILIKE 'am%' LIMIT 100



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

* Re: BUG #18438: regex isnt working for "^" , ".*"
  2024-04-15 19:49 BUG #18438: regex isnt working for "^" , ".*" PG Bug reporting form <noreply@postgresql.org>
@ 2024-04-15 21:00 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2024-04-15 21:00 UTC (permalink / raw)
  To: ankurawesome37@gmail.com; pgsql-bugs@lists.postgresql.org

On Mon, Apr 15, 2024 at 1:20 PM PG Bug reporting form <
noreply@postgresql.org> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      18438
> Logged by:          Ankur Kumar
> Email address:      ankurawesome37@gmail.com
> PostgreSQL version: 14.5
> Operating system:   macos ventura version 13.5
> Description:
>
> hey , i am getting empty query result while using postgres regex operator
> "^" , ".*" etc . I am able to use "%" correctly but not getting any
> response
> for  other regex operator


As the opening paragraph of the relevant docs say:

There are three separate approaches to pattern matching provided by
PostgreSQL: the traditional SQL LIKE operator, the more recent SIMILAR TO
operator (added in SQL:1999), and POSIX-style regular expressions. Aside
from the basic “does this string match this pattern?” operators, functions
are available to extract or replace matching substrings and to split a
string at matching locations.

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

You are mixing the first and third ones together.

David J.

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


end of thread, other threads:[~2024-04-15 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 19:49 BUG #18438: regex isnt working for "^" , ".*" PG Bug reporting form <noreply@postgresql.org>
2024-04-15 21:00 ` David G. Johnston <david.g.johnston@gmail.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