Re: [SQL] A search SQL query - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] A search SQL query
Date
Msg-id 29400.944175902@sss.pgh.pa.us
Whole thread Raw
In response to RE: [SQL] A search SQL query  (<kaiq@realtyideas.com>)
List pgsql-sql
<kaiq@realtyideas.com> writes:
> seems we'll fall below the bottom line: even regular expression can not
> work here. Since "-" can be anywhere, no easy way out.

Sure you can do it with a regular expression ... it's ugly but you can
do it:

where partno ~ 'L-?M-?7-?4-?1-?C-?N-?S-?G-?S'

or possibly

where partno ~ 'L-*M-*7-*4-*1-*C-*N-*S-*G-*S'

if you need to allow multiple consecutive dashes.  '-?' means 0 or 1
dash, '-*' means 0 or more dashes...
        regards, tom lane


pgsql-sql by date:

Previous
From: Rini Dutta
Date:
Subject: SQLState
Next
From: Tom Lane
Date:
Subject: Re: [SQL] How to avoid "Out of memory" using aggregate functions?