Skip site navigation (1) Skip section navigation (2)

BUG #5239: Recursive complex query

From: "Recursive complex query" <gusta1308(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5239: Recursive complex query
Date: 2009-12-10 18:27:47
Message-ID: 200912101827.nBAIRlVq031495@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5239
Logged by:          Recursive complex query
Email address:      gusta1308(at)gmail(dot)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

Responses

pgsql-bugs by date

Next:From: Robert HaasDate: 2009-12-10 18:49:21
Subject: Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly
Previous:From: Robert HaasDate: 2009-12-10 18:03:39
Subject: Re: BUG #5234: ALTER TABLE ... RENAME COLUMN change view definition incorrectly

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group