Re: [GENERAL] Determining if "in a text set"

From: Richi Plana <richip(at)mozcom(dot)com>
To: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Determining if "in a text set"
Date: 1999-03-28 18:56:04
Message-ID: Pine.LNX.4.04.9903290235290.5417-100000@jaguar.mozcom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi,

On Sun, 28 Mar 1999, Herouth Maoz wrote:

|o| perl's concept of word boundaries. But if the phrase is supposed to contain
|o| just spaces (ascii 32, if you will) as word separators, I'd match against
|o| the field with a space on the left and nothing on the right, a space on the
|o| right and nothing on the left, spaces on both sides, or standing alone:
|o|
|o| SELECT * FROM {class}
|o| WHERE '{phrase}' ~ ' ' || ( rtrim( FieldN ) || '$' )
|o| OR '{phrase}' ~ '^' || ( rtrim( FieldN ) || ' ' )
|o| OR '{phrase}' ~ ' ' || ( rtrim( FieldN ) || ' ' )
|o| OR '{phrase}' = rtrim( FieldN );

1) I'm not sure the regex thing is ANSI SQL and would port to other SQL
systems easilly
2) Isn't there a way to do [^{ws}](word)[{ws}$], where [^{ws}] means
either the start or a whitespace and [{ws}$] means either a whitespace or
EOL?
3) When I try the concat strings operator (||), I get the following psql
error:

ERROR: parser: syntax error at or near "||"

What am I doing wrong? (I'm using PostgreSQL 6.4.2 on Sparc/Solaris with
GCC compiler) There's something wrong with the concat operator on my
system. I get diff. results from the ff. commands:

SELECT * FROM {class} where 'MON' = FieldN; and
SELECT * FROM {class} where 'MO' || 'N' = fieldN;

Anybody have a clue.

L L Richi Plana 8^) ,-,-. ,-,-. ,-,-. ,-,-. ,-
LL LL Systems Administrator / / \ \ / / \ \ / / \ \ / / \ \ / /
LLLLL Mosaic Communications, Inc. \ \ / / \ \ / / \ \ / / \ \ / /
LLLLL mailto:richip(at)mozcom(dot)com `-'-' `-'-' `-'-' `-'-'
------------------------------------------------------------------------
P G P Key available at http://www2.mozcom.com/~richip/richip.asc
Tired of Spam? Join this CAUCE! http://www.cauce.org/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richi Plana 1999-03-28 19:11:54 Re: [SQL] Re: [GENERAL] Determining if "in a text set"
Previous Message Richi Plana 1999-03-28 18:10:55 Re: [SQL] Re: [GENERAL] Determining if "in a text set"

Browse pgsql-sql by date

  From Date Subject
Next Message Richi Plana 1999-03-28 19:11:54 Re: [SQL] Re: [GENERAL] Determining if "in a text set"
Previous Message Richi Plana 1999-03-28 18:10:55 Re: [SQL] Re: [GENERAL] Determining if "in a text set"