1
選択再帰CTEでは動作しないようです。は、ORDER BYは、私がキー一種として固定サイズのIDを連結していCTEの
with recursive cte(
uno_id,
uno_tp,
pnt_uno_id,
status,
title,
content,
sorter,
depth)
as(select
uno.uno_id,
uno.uno_tp,
uno.pnt_uno_id,
uno.status,
uno.title,
uno.content,
uno.uno_id::text,
1
from uno
where uno.uno_id = \$1
union all
select uno.uno_id,
uno.uno_tp,
uno.pnt_uno_id,
uno.status,
uno.title,
uno.content,
cte.sorter || '-' || uno.uno_id::text,
cte.depth + 1 AS depth
from uno
join cte ON uno.pnt_uno_id = cte.uno_id
)
select *
from cte
order by sorter;
、ここuno_id
と示すリストですsorter
コラム:
1152288185909250, 1152288185909250
1158885255675908, 1152288185909250-1158885255675908
1158885255675906, 1152288185909250-1158885255675906
1158885255675907, 1152288185909250-1158885255675906-1158885255675907
あなたは二行は場違いで見ることができるように - それはする必要があり、実際に最後の行。
どうすればこの問題を解決できますか?
NEVER MIND。 Postgresは正しく動作していました。サーバーとクライアント間の転送では、アレイの正しい順序が維持されませんでした。
不必要なヘッドスクラッチと感謝申し訳ありません。
はい - これは私が期待したものです。もっと研究してみましょう。 –
あなたのテストケースを実行しているときに '構文エラーが発生したとき' x "' - SELECTステートメントでVALUESを使用しているように見慣れないのですか? –
最後のコメントを無視してください。あなたのテストのために同じ結果。私のところでもっと探していました。 –