Explanation of tree-generating query

Поиск
Список
Период
Сортировка
От Guyren Howe
Тема Explanation of tree-generating query
Дата
Msg-id 4149AB44-016F-40B3-A3E1-F61AD150A406@gmail.com
обсуждение исходный текст
Ответы Re: Explanation of tree-generating query  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Explanation of tree-generating query  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
I feel like I'm pretty decent with Postgres. But I saw the following query on the excellent Periscope blog. I've no idea how it works, and the various symbols involved are difficult to look up either with google or in the documentation. I believe the @ sign is probably ABS, but the <= clause in the consequent of a when-then is something I haven't seen before. I'm comfortable with the rest. Can someone explain how this works?

with a as (    select *   from     generate_series(0, 3, 1) ) , b as (   select *   from     generate_series(-3, 3, 1) ) , tree as (   select a.generate_series as t     , b.generate_series as branch   from a, b   where     case when mod(a.generate_series, 2) = 1       then @ b.generate_series <= a.generate_series         and mod(@ b.generate_series, 2) = 1       else @ b.generate_series <= a.generate_series         and mod(@ b.generate_series, 2) = 0     end )

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: handling time series data
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: MongoDB FDW Problem.