Re: psql can't subtract

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: psql can't subtract
Date: 2011-03-25 16:30:30
Message-ID: 4D8CC326.8070508@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.
>
> If there is no match the initial position will be zero. Minus one will
> give you a negative substring length.
>
Of course. One lousy malformed input record. The speed at which the
failure occurred lead me to think it was a parsing issue. Turns out the
bogus record was "near the front of the queue".

Thanks

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2011-03-25 16:59:00 Re: psql can't subtract
Previous Message Marco 2011-03-25 16:23:32 Re: Need help for constructing query