Re: [GENERAL] psql can't subtract

2011-03-25 Thread Rob Sargent
On 03/25/2011 10:59 AM, hubert depesz lubaczewski wrote: On Fri, Mar 25, 2011 at 09:29:57AM -0600, Rob Sargent wrote: Running 9.0.3 (client and server) Seems I cannot subtract 1 from the result of position. select distinct substring( substring(xml_text,1,300), pos

Re: [GENERAL] psql can't subtract

2011-03-25 Thread hubert depesz lubaczewski
On Fri, Mar 25, 2011 at 09:29:57AM -0600, Rob Sargent wrote: > Running 9.0.3 (client and server) > > > Seems I cannot subtract 1 from the result of position. > > select distinct >substring( substring(xml_text,1,300), > position( 'xmlns=' in substring(xml_text,1,300)) +

Re: [GENERAL] psql can't subtract

2011-03-25 Thread Rob Sargent
On 03/25/2011 09:57 AM, Richard Huxton wrote: On 25/03/11 15:29, Rob Sargent wrote: Running 9.0.3 (client and server) select distinct substring( ... position( 'xmlns=' in substring(xml_text,1,300)) + length('xmlns="'), 100))) -1 ... gives ERROR: negative substring length not allowed.

Re: [GENERAL] psql can't subtract

2011-03-25 Thread Richard Huxton
On 25/03/11 15:29, Rob Sargent wrote: Running 9.0.3 (client and server) select distinct substring( ... position( 'xmlns=' in substring(xml_text,1,300)) + length('xmlns="'), 100))) -1 ... gives ERROR: negative substring length not allowed. If there is no match the initial position will be