| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | "Jonathan Ellis" <jellis(at)advocast(dot)com> | 
| Cc: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: String function page incorrect? | 
| Date: | 2000-11-30 23:05:42 | 
| Message-ID: | 26096.975625542@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general pgsql-sql | 
"Jonathan Ellis" <jellis(at)advocast(dot)com> writes:
> I'm trying to find the correct function that returns the location of a
> substring within a string.  Looking at
> http://www.postgresql.org/docs/user/x2731.htm, it gives the Function name as
> "textpos" but in the Example column it uses "position".  But neither one
> works!
Yeah, that seems to be a few versions out of date :-(
The page should probably refer to "strpos", which is the true function
name:
play=> select strpos('high','ig');
 strpos
--------
      2
(1 row)
You can also use the SQL92 POSITION syntax:
play=>  select position('ig' in 'high');
 strpos
--------
      2
(1 row)
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chris Jones | 2000-11-30 23:20:52 | strange query plans | 
| Previous Message | Joel Bernstein | 2000-11-30 22:59:58 | Transaction logging | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Roberto Mello | 2000-11-30 23:25:15 | Re: String function page incorrect? | 
| Previous Message | Stephan Szabo | 2000-11-30 22:35:36 | Re: I get an error with Foreign Keys |