pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
String function page incorrect?
3+ messages / 3 participants
[nested] [flat]

* String function page incorrect?
@ 2000-11-30 19:40  Jonathan Ellis <jellis@advocast.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Jonathan Ellis @ 2000-11-30 19:40 UTC (permalink / raw)
  To: pgsql-sql

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!

bf2=# select position('high', 'ig');
ERROR:  parser: parse error at or near ","

bf2=# select textpos('high', 'ig');
ERROR:  Function 'textpos(unknown, unknown)' does not exist
 Unable to identify a function that satisfies the given argument types
 You may need to add explicit typecasts

bf2=# select textpos(text('high'), text('ig'));
ERROR:  Function 'textpos(text, text)' does not exist
 Unable to identify a function that satisfies the given argument types
 You may need to add explicit typecasts

???

-Jonathan




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: String function page incorrect?
@ 2000-11-30 23:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jonathan Ellis <jellis@advocast.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2000-11-30 23:05 UTC (permalink / raw)
  To: Jonathan Ellis <jellis@advocast.com>; +Cc: pgsql-sql

"Jonathan Ellis" <jellis@advocast.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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: String function page incorrect?
@ 2000-11-30 23:25  Roberto Mello <rmello@cc.usu.edu>
  parent: Jonathan Ellis <jellis@advocast.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Roberto Mello @ 2000-11-30 23:25 UTC (permalink / raw)
  To: Jonathan Ellis <jellis@advocast.com>; +Cc: pgsql-sql

Jonathan Ellis wrote:
> 
> 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!
> 
> bf2=# select position('high', 'ig');
> ERROR:  parser: parse error at or near ","

	You need SELECT position('ig' in 'high');

lbn=# select position('ig' in 'high');
 strpos 
--------
      2
(1 row)

	-Roberto
-- 
Computer Science			Utah State University
Space Dynamics Laboratory		Web Developer
USU Free Software & GNU/Linux Club 	http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-11-30 23:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-30 19:40 String function page incorrect? Jonathan Ellis <jellis@advocast.com>
2000-11-30 23:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-11-30 23:25 ` Roberto Mello <rmello@cc.usu.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox