Received: from nezu.gs.verio.net (nezu.gs.verio.net [204.27.65.34]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6NIb1f09939 for ; Mon, 23 Jul 2001 14:37:02 -0400 (EDT) (envelope-from jeckermann@verio.net) Received: by NEZU with Internet Mail Service (5.5.2650.21) id <3G6FXDDY>; Mon, 23 Jul 2001 13:36:55 -0500 Message-ID: <08CD1781F85AD4118E0800A0C9B8580B094B57@NEZU> From: Jeff Eckermann To: "'karl@tecc.co.uk'" , pgsql-sql@postgresql.org Subject: RE: position(text,text) function Date: Mon, 23 Jul 2001 13:36:54 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-Archive-Number: 200107/314 X-Sequence-Number: 4122 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