Não foi o que você perguntou, mas alertando para um problema potencial:

2016-10-18 15:19 GMT-02:00 Izaque Maciel <[email protected]>:
>
>     select date
> from generate_series(new.dtinicial::timestamp,
>                       new.dtfinal, '1 day') date
> where extract(dow from date) not in (0,6)
>   LOOP
>     INSERT INTO tarefa_itens (id, id_tarefaag, data_horafin,
>      data_horaexec, executada)
> VALUES ((select coalesce((max(ti.id) + 1), 1)
> chave from tarefa_itens ti),
>   new.id,
>   null,
>             rec.date       -- Aqui
>   'N');

Essa tabela tem chave natural, ou só artificial?  Porque a artificial
não garante unicidade, e se for só ela dará problema mais cedo ou mais
tarde.


-- 
skype:leandro.gfc.dutra?chat      Yahoo!: ymsgr:sendIM?lgcdutra
+55 (61) 3546 7191              gTalk: xmpp:[email protected]
+55 (61) 9302 2691        ICQ/AIM: aim:GoIM?screenname=61287803
BRAZIL GMT−3  MSN: msnim:[email protected]
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a