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

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: plpgsql at what point does the knowledge of the query come in?
Дата
Msg-id 4EA095AA.5090107@iol.ie
обсуждение исходный текст
Ответ на Re: plpgsql at what point does the knowledge of the query come in?  (Henry Drexler <alonup8tb@gmail.com>)
Ответы Re: plpgsql at what point does the knowledge of the query come in?
Re: plpgsql at what point does the knowledge of the query come in?
Список pgsql-general
On 20/10/2011 22:31, Henry Drexler wrote:
>
> On Thu, Oct 20, 2011 at 4:57 PM, Raymond O'Donnell <rod@iol.ie
> <mailto:rod@iol.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@iol.ie

В списке pgsql-general по дате отправления:

Предыдущее
От: Henry Drexler
Дата:
Сообщение: Re: plpgsql at what point does the knowledge of the query come in?
Следующее
От: Joe Abbate
Дата:
Сообщение: Re: how to disable all pkey/fkey constraints globally