Código SQL:
Ver originalpruebas=> SELECT *FROM a;
a | b | c | fecha
---+---+---+------------
1 | 1 | 1 | 2010-01-01
2 | 2 | 2 | 2010-03-02
3 | 3 | 3 | 2010-11-10
(3 filas)
pruebas=> SELECT *FROM b;
d | e | f | fecha2
---+---+---+------------
4 | 4 | 4 | 2010-08-07
5 | 5 | 5 | 2010-11-12
(2 filas)
pruebas=> SELECT a::text,b::text,c::text,'' AS d,'' AS e,'' AS f,fecha FROM a
pruebas-> UNION
pruebas-> SELECT '','','',d::text,e::text,f::text,fecha2 FROM b
pruebas-> ORDER BY 7;
a | b | c | d | e | f | fecha
---+---+---+---+---+---+------------
1 | 1 | 1 | | | | 2010-01-01
2 | 2 | 2 | | | | 2010-03-02
| | | 4 | 4 | 4 | 2010-08-07
3 | 3 | 3 | | | | 2010-11-10
| | | 5 | 5 | 5 | 2010-11-12
(5 filas)
saludos