Re: using CAST and LIKE

From: Timothy Wood <timothy(at)hallcomp(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pg-general <pgsql-general(at)postgresql(dot)org>, PG Explorer <pgmail(at)pgexplorer(dot)com>
Subject: Re: using CAST and LIKE
Date: 2002-04-15 21:34:48
Message-ID: 1018906488.29837.31.camel@phobos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2002-04-15 at 15:46, Tom Lane wrote:
> Timothy Wood <timothy(at)hallcomp(dot)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,

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message deyanira 2002-04-15 21:36:43 interface graphics Postgres to Nextstep
Previous Message elein 2002-04-15 21:29:21 Re: DataBlades