Skip site navigation (1) Skip section navigation (2)

Re: String function page incorrect?

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 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

In response to

Responses

pgsql-sql by date

Next:From: Roberto MelloDate: 2000-11-30 23:25:15
Subject: Re: String function page incorrect?
Previous:From: Stephan SzaboDate: 2000-11-30 22:35:36
Subject: Re: I get an error with Foreign Keys

pgsql-general by date

Next:From: Chris JonesDate: 2000-11-30 23:20:52
Subject: strange query plans
Previous:From: Joel BernsteinDate: 2000-11-30 22:59:58
Subject: Transaction logging

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group