WITH statement does not persist outside of query I run a select to check what records I should register in another table.

Each record returned in the query I should give an insert in my table campanha_cliente_chamada.

WITH psql as ( /* stuff */ )    
SELECT * FROM psql; 

WITH disca ( /* reads from psql */ )  
INSERT INTO callcenter.campanha_cliente_chamada ( columns )
SELECT col1, col2, col3
FROM   disca;


This is the error I'm getting.

Error : relation psql does not exist LINE 11: ( SELECT
id_camapanha_cliente FROM psql),(SELECT c...
                          ^
You can actually chain CTEs:

WITH psql as ( /* stuff */ ),    
disca as ( SELECT * FROM psql )  
INSERT INTO callcenter.campanha_cliente_chamada ( columns )
SELECT col1, col2, col3
FROM   disca;


... which may help you.