recursive seek...?
От | Vazsonyi Peter[ke] |
---|---|
Тема | recursive seek...? |
Дата | |
Msg-id | Pine.A32.3.96.980316145935.20524B-100000@kornel.szif.hu обсуждение исходный текст |
Ответ на | Re: [HACKERS] Views on aggregates - need assistence (Bruce Momjian <maillist@candle.pha.pa.us>) |
Список | pgsql-hackers |
Kello! I have a recusive relation, like this: => create table re( name text, oid parent); and needed the name from a tuple, and the name of all parents... i tryd some, like: => create function fullname(oid) returns text -> as 'select fullname(re.parent) || re.name from re where re.oid=$1;' -> language 'sql'; that isn't work. of course ;( i can get a name, and the parents oid, and the oid of parents parent etc... with _MORE_ queries. for example: => select oid,* from re; oid | name | parent ----+------+-------- 5000|one | (NULL or 0) 5001|two | 5000 5002|3d | 5000 5003|4d | 5002 i now the oid:5003. i need the name: "one/two/4d" must i send thees queries to the backend? (in pseudo code): $curr=5003 $fulln='' while $curr do => SELECT name, parent FROM re WHERE oid=$curr; $fulln='$fulln/$name'; $curr=$parent; enddo so i liked send _ONLY_ 5003, and reveive in a trice the full name. this time i can't this ;( sprintf ("`-''-/").___..--''"`-._ Error In ("%|s", `6_ 6 ) `-. ( ).`-.__.`) Loading Object "Petike" (_Y_.)' ._ ) `._ `. ``-..-' line:3 /* Neko */ _..`--'_..-_/ /--'_.' ,' Before /*Neko*/ ); (il),-'' (li),' ((!.-' see: http://lsc.kva.hu
В списке pgsql-hackers по дате отправления: