Re: using CAST and LIKE - Mailing list pgsql-general

From Timothy Wood
Subject Re: using CAST and LIKE
Date
Msg-id 1018906488.29837.31.camel@phobos
Whole thread Raw
In response to Re: using CAST and LIKE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: using CAST and LIKE
List pgsql-general
On Mon, 2002-04-15 at 15:46, Tom Lane wrote:
> Timothy Wood <timothy@hallcomp.com> writes:
> > SELECT * FROM table WHERE CAST('field' AS TEXT) LIKE '%value%';
>
> I think you meant
>
> SELECT * FROM table WHERE CAST(field AS TEXT) LIKE '%value%';
>
>             regards, tom lane
>

Ahh, that does seem to work.  Big difference without the single quotes.
What exactly is the big difference there or what do the single quotes do
that I was not aware of when I used them?

The regular expressions do seem like a better idea, but is there any
benefit over one or the other aside from the flexibility of the regexps?

Thanks again

Timothy,


pgsql-general by date:

Previous
From: "Jeffrey W. Baker"
Date:
Subject: Re: How do I list all users and all databases.
Next
From: elein
Date:
Subject: Re: DataBlades