Re: psql can't subtract

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

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.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco 2011-03-25 16:23:32 Re: Need help for constructing query
Previous Message Selena Deckelmann 2011-03-25 15:38:01 Re: foreign data wrappers