pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: position(text,text) function
6+ messages / 5 participants
[nested] [flat]
* Re: position(text,text) function
@ 1970-01-01 00:00 omid omoomi <oomoomi@hotmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: omid omoomi @ 1970-01-01 00:00 UTC (permalink / raw)
To: karl@tecc.co.uk; pgsql-sql
position ( 'el' in 'hello') ;
>From: karl@tecc.co.uk (Karl Orbell)
>To: pgsql-sql@postgresql.org
>Subject: [SQL] position(text,text) function
>Date: Mon, 23 Jul 2001 14:27:15 +0000 (UTC)
>
>I'm having trouble using the position function, it's a simple built-in
>function.
>
>It returns the index of a substring within a main string.
>
>But, I just can't get it to work, it always gives this silly parser error.
>I've tried it in a variety of ways with variables instead of constants
>casting
>to text and using it in other contexts, (ie. in functions, not just in a
>select). What am I doing wrong? Is this not the correct syntax for a two
>argument function?
>
>test=# select position('hello','el');
>ERROR: parser: parse error at or near ","
>
>
>Karl Orbell.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
^ permalink raw reply [nested|flat] 6+ messages in thread
* position(text,text) function
@ 2001-07-23 14:27 Karl Orbell <karl@tecc.co.uk>
0 siblings, 2 replies; 6+ messages in thread
From: karl@tecc.co.uk @ 2001-07-23 14:27 UTC (permalink / raw)
To: pgsql-sql
I'm having trouble using the position function, it's a simple built-in function.
It returns the index of a substring within a main string.
But, I just can't get it to work, it always gives this silly parser error.
I've tried it in a variety of ways with variables instead of constants casting
to text and using it in other contexts, (ie. in functions, not just in a
select). What am I doing wrong? Is this not the correct syntax for a two
argument function?
test=# select position('hello','el');
ERROR: parser: parse error at or near ","
Karl Orbell.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: position(text,text) function
@ 2001-07-23 17:58 Dorin Grunberg <dorin@visgen.com>
parent: Karl Orbell <karl@tecc.co.uk>
1 sibling, 0 replies; 6+ messages in thread
From: Dorin Grunberg @ 2001-07-23 17:58 UTC (permalink / raw)
To: karl@tecc.co.uk; pgsql-sql
The correct way would be:
select position('el' in 'Hello');
Dorin
At 02:27 PM 7/23/01 +0000, Karl Orbell wrote:
>I'm having trouble using the position function, it's a simple built-in
>function.
>
>It returns the index of a substring within a main string.
>
>But, I just can't get it to work, it always gives this silly parser error.
>I've tried it in a variety of ways with variables instead of constants
>casting
>to text and using it in other contexts, (ie. in functions, not just in a
>select). What am I doing wrong? Is this not the correct syntax for a two
>argument function?
>
>test=# select position('hello','el');
>ERROR: parser: parse error at or near ","
>
>
>Karl Orbell.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
^ permalink raw reply [nested|flat] 6+ messages in thread
* RE: position(text,text) function
@ 2001-07-23 18:36 Jeff Eckermann <jeckermann@verio.net>
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Eckermann @ 2001-07-23 18:36 UTC (permalink / raw)
To: 'karl@tecc.co.uk' <karl@tecc.co.uk>; pgsql-sql
You are confusing the syntax of two similar functions:
position ('substring' in 'string')
strpos ('string', 'substring').
I have a feeling that "position" actually calls "strpos", but I am guessing
on that.
> -----Original Message-----
> From: karl@tecc.co.uk [SMTP:karl@tecc.co.uk]
> Sent: Monday, July 23, 2001 9:27 AM
> To: pgsql-sql@postgresql.org
> Subject: position(text,text) function
>
> I'm having trouble using the position function, it's a simple built-in
> function.
>
> It returns the index of a substring within a main string.
>
> But, I just can't get it to work, it always gives this silly parser error.
> I've tried it in a variety of ways with variables instead of constants
> casting
> to text and using it in other contexts, (ie. in functions, not just in a
> select). What am I doing wrong? Is this not the correct syntax for a two
>
> argument function?
>
> test=# select position('hello','el');
> ERROR: parser: parse error at or near ","
>
>
> Karl Orbell.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: RE: position(text,text) function
@ 2001-07-23 19:06 Josh Berkus <josh@agliodbs.com>
parent: Jeff Eckermann <jeckermann@verio.net>
0 siblings, 0 replies; 6+ messages in thread
From: Josh Berkus @ 2001-07-23 19:06 UTC (permalink / raw)
To: Jeff Eckermann <jeckermann@verio.net>; 'karl@tecc.co.uk' <karl@tecc.co.uk>; pgsql-sql
Jeff, Karl,
Actually, he's confusing 3 functions. See postgresql.org --> user
lounge --> interactive docs --> functions and operators --> string
functions.
-Josh
> You are confusing the syntax of two similar functions:
> position ('substring' in 'string')
> strpos ('string', 'substring').
> I have a feeling that "position" actually calls "strpos", but I am
> guessing
> on that.
>
> > -----Original Message-----
> > From: karl@tecc.co.uk [SMTP:karl@tecc.co.uk]
> > Sent: Monday, July 23, 2001 9:27 AM
> > To: pgsql-sql@postgresql.org
> > Subject: position(text,text) function
> >
> > I'm having trouble using the position function, it's a simple
> built-in
> > function.
> >
> > It returns the index of a substring within a main string.
> >
> > But, I just can't get it to work, it always gives this silly parser
> error.
> > I've tried it in a variety of ways with variables instead of
> constants
> > casting
> > to text and using it in other contexts, (ie. in functions, not just
> in a
> > select). What am I doing wrong? Is this not the correct syntax
> for a two
> >
> > argument function?
> >
> > test=# select position('hello','el');
> > ERROR: parser: parse error at or near ","
> >
> >
> > Karl Orbell.
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: position(text,text) function
@ 2001-07-24 13:53 Karl Orbell <karl@tecc.co.uk>
parent: Karl Orbell <karl@tecc.co.uk>
1 sibling, 0 replies; 6+ messages in thread
From: karl@tecc.co.uk @ 2001-07-24 13:53 UTC (permalink / raw)
To: pgsql-sql
Many thanks for all of the assistance on this question.
I can't say I've ever seen the "a in b" syntax in postgres, but
you live and learn. ;-)
Thanks again.
Karl.
In article <slrn9loctm.qsr.karl@azrael.tecc.co.uk>, Karl Orbell wrote:
> I'm having trouble using the position function, it's a simple built-in function.
>
> It returns the index of a substring within a main string.
>
> But, I just can't get it to work, it always gives this silly parser error.
> I've tried it in a variety of ways with variables instead of constants casting
> to text and using it in other contexts, (ie. in functions, not just in a
> select). What am I doing wrong? Is this not the correct syntax for a two
> argument function?
>
> test=# select position('hello','el');
> ERROR: parser: parse error at or near ","
>
>
> Karl Orbell.
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2001-07-24 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1970-01-01 00:00 Re: position(text,text) function omid omoomi <oomoomi@hotmail.com>
2001-07-23 14:27 position(text,text) function Karl Orbell <karl@tecc.co.uk>
2001-07-23 17:58 ` Dorin Grunberg <dorin@visgen.com>
2001-07-24 13:53 ` Karl Orbell <karl@tecc.co.uk>
2001-07-23 18:36 RE: position(text,text) function Jeff Eckermann <jeckermann@verio.net>
2001-07-23 19:06 ` Josh Berkus <josh@agliodbs.com>
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