Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/10/2011 22:31, Henry Drexler wrote:
> 
> On Thu, Oct 20, 2011 at 4:57 PM, Raymond O'Donnell <rod@xxxxxx
> <mailto:rod@xxxxxx>> 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@xxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux