Re: plpgsql at what point does the knowledge of the query come in?

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Henry Drexler <alonup8tb(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql at what point does the knowledge of the query come in?
Date: 2011-10-20 21:42:02
Message-ID: 4EA095AA.5090107@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 20/10/2011 22:31, Henry Drexler wrote:
>
> On Thu, Oct 20, 2011 at 4:57 PM, Raymond O'Donnell <rod(at)iol(dot)ie
> <mailto:rod(at)iol(dot)ie>> wrote:
>
>
>
> Not sure what you mean by the above...
>
> Ray.
>
>
> This is what I thought it was doing.
> 1. it gets the node from the first row
> 2. measures its length
> 3. then loops through removing one character at a time and comparing
> that to the whole column/query
> 4. for threeee it found a match in threee

I was just trying to figure your function out... :-) I think you're
mistaken about step 3 - This statement -

node = substring(newnode, 1, i-1) || substring (newnode, i+1, nnlength)

- is contatenating two substrings - the first bit (up to the i-th
character) and the rest, and then comparing that to "node".

In fact, the second substring() call looks as if it will overrun the end
of the string in "newnode".

What version of PostgreSQL are you using? The docs for 9.0 show two
substring functions:

substring(string [from int] [for int])
substr(string, from [, count])

and a couple of variants using regexps, and what you have above doesn't
match any of them.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2011-10-20 21:52:34 Re: plpgsql at what point does the knowledge of the query come in?
Previous Message Raymond O'Donnell 2011-10-20 21:41:52 Re: plpgsql at what point does the knowledge of the query come in?