BUG #5239: Recursive complex query

Поиск
Список
Период
Сортировка
Искать

BUG #5239: Recursive complex query

От:
"Recursive complex query" <gusta1308@gmail.com>
Дата:
The following bug has been logged online:

Bug reference:      5239
Logged by:          Recursive complex query
Email address:      gusta1308@gmail.com
PostgreSQL version: 8.4
Operating system:   Windows XP SP 2
Description:        Recursive complex query
Details: 

I try to run following query:

    with recursive data (cid, rid, fini, ffin) as (
      select 
        po1.cliente_id,
        po1.ramo_id,
        po1.inicio,
        po1.final
      from tm_polizas po1
        inner join (
          select 
            pol.cliente_id,
            pol.ramo_id,
            max(pol.final) final
          from tm_polizas pol
          where pol.final >= (date '2009-01-01')
          group by pol.cliente_id,
            pol.ramo_id
        ) x1 
          on x1.cliente_id = po1.cliente_id
          and x1.ramo_id = po1.ramo_id
          and x1.final = po1.final
          	
      union all
            
      select
        po2.cliente_id,
        po2.ramo_id,
        po2.inicio,
        data.ffin final
      from tm_polizas po2
        inner join data
          on po2.cliente_id = data.cid
          and po2.ramo_id = data.rid
          and po2.final >= (fini - 90)
    )
    select
      cid cliente_id,
      rid ramo_id,
      min(fini) inicio,
      max(ffin) final
    from data
    group by cid, rid;

and the server report me the error: "ERROR:  write failed"

This table contain 5 million rows

Thank

Re: BUG #5239: Recursive complex query

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Recursive complex query"  writes:
> and the server report me the error: "ERROR:  write failed"

Maybe you ran out of disk space?  Are you sure the recursion terminates
at all, or does so before generating an enormous number of rows?

			regards, tom lane
FAQ