Bom dia Osvaldo
Ai ele inverte:
-bash-3.1$ psql -d teste -f teste.sql 2> resultado.log
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
-bash-3.1$ cat resultado.log
psql:teste.sql:2: ERROR: syntax error at or near "^"
LINE 1: ^
^
psql:teste.sql:6: ERROR: column "a" does not exist
LINE 1: insert into teste_psql VALUES (1,a);
Tava precisando guarda tanto a falha quanto o sucesso.
Ats
________________________________
De: Osvaldo Kussama <[email protected]>
Para: Comunidade PostgreSQL Brasileira <[email protected]>
Enviadas: Quinta-feira, 25 de Março de 2010 10:21:53
Assunto: Re: [pgbr-geral] Guarda saida do Psql com erro.
2010/3/25 paulo matadr <[email protected]>:
> Bom dia a Todos,
> Preciso que o psql guarde no log de execulcao todas as msg geradas,
> percebi o seguinte:
>
>
> postgres=# create database teste;
> CREATE DATABASE
> postgres=# \c teste;
> You are now connected to database "teste".
> teste=# create table teste_psql( a int , b int);
> CREATE TABLE
> -bash-3.1$ cat > teste.sql
> insert into teste_psql VALUES (1,1); ^
> insert into teste_psql VALUES (1,2);
> insert into teste_psql VALUES (1,3);
> insert into teste_psql VALUES (1,4);
> insert into teste_psql VALUES (1,5);
> insert into teste_psql VALUES (1,a);
>
>
> ---so imprime o error na tela----
> -bash-3.1$ psql -d teste -f teste.sql > resultado.log
> psql:teste.sql:2: ERROR: syntax error at or near "^"
> LINE 1: ^
> ^
> psql:teste.sql:6: ERROR: column "a" does not exist
> LINE 1: insert into teste_psql VALUES (1,a);
>
> -bash-3.1$ cat resultado.log
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> teste=# select * from teste_psql;
> a | b
> ---+---
> 1 | 1
> 1 | 3
> 1 | 4
> 1 | 5
> (4 rows)
> existe a possibidade de exporta pro log tanto sucesso quanto a falha?
>
Tente:
psql -d teste -f teste.sql 2> resultado.log
Osvaldo
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral