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

Поиск
Список
Период
Сортировка
От Henry Drexler
Тема Re: plpgsql at what point does the knowledge of the query come in?
Дата
Msg-id CAAtgU9RDYt-H_rcjc0Wq9X_Gjm0MvqUdovHsHGP8VvKBu9PHcA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: plpgsql at what point does the knowledge of the query come in?  (Henry Drexler <alonup8tb@gmail.com>)
Список pgsql-general


On Fri, Oct 21, 2011 at 2:57 PM, Henry Drexler <alonup8tb@gmail.com> wrote:
I realize I have sent a lot of messages on this thread so this will be the last one unless I come up with a solution, then I will post that.


Resolved.

Ray - thanks again for your help.

The pattern was it was only matching those that had a change to the end of the partner word.
so the function was going through then only returning the last comparison.

I needed to add an if statement into the function to 'return r' when it evaluated to true.

Thus:

 create or replace function nnodetestt(text) returns text language plpgsql immutable as $$
DECLARE
newnode alias for $1;
nnlength integer;
t text;
nmarker text;
BEGIN
nnlength := length(newnode);
RAISE NOTICE 'number %', nnlength;
for i in 1..(nnlength) loop


select into t node from (Values('one'),('on'),('fivehundredsixtyseven'),('fivehundredsixtysevens'),('one two three fou'),('one two three four'),('onetwo three ninety'),('one two three ninety')) blast(node) where node = left(newnode, i-1)||right(newnode, nnlength-i);
-- RAISE NOTICE 'nnlength %', nnlength;
--raise notice 'increment %',right(newnode, nnlength-i);
RAISE NOTICE 'textbreakout: %' , left(newnode, i-1)||right(newnode, nnlength-i);

if t = left(newnode, i-1)||right(newnode, nnlength-i) then return t;
end if;

end loop;
return t;
END;
$$

select
node,
nnodetestt(node)
from
(Values('one'),('on'),('fivehundredsixtyseven'),('fivehundredsixtysevens'),('one two three fou'),('one two three four'),('onetwo three ninety'),('one two three ninety'))
blast(node)

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

Предыдущее
От: Henry Drexler
Дата:
Сообщение: Re: plpgsql at what point does the knowledge of the query come in?
Следующее
От: miesi
Дата:
Сообщение: Anyone using the solaris 11 precompiled binaries on opensolaris snv_134