Bom dia, pessoal.
Alguém sabe me dizer o porque deste erro na hora de criar uma função no banco
de dados usando uma função feita em C.
Erro:
ERROR: could not load library "/usr/local/pgsql/lib/teste.so":
/usr/local/pgsql/lib/teste.so: undefined symbol: ECPGdo
SQL state: 58P01
Estou utilizando o PostgreSQL 8.2.6 com o Ubuntu 9.04. Já tentei também no
PostgreSQL 8.3.6, o erro é o mesmo.
Arquivo teste.c gerado pelo ECPG do PostgreSQL. Esta função é somente de teste.
Vou colocar somente o trecho que esta utilizando a função " ECPGdo ".
PG_FUNCTION_INFO_V1(retornar_clientes);
Datum
retornar_clientes(PG_FUNCTION_ARGS){
int32 p_sequencia;
int32 wtamanho_texto = 100002 - VARHDRSZ;
text *wreturn = (text *) palloc(wtamanho_texto);
/* exec sql begin declare section */
#line 20 "teste.pgc"
int wcodcli ;
#line 21 "teste.pgc"
struct varchar_wnome { int len; char arr[ 50 ]; } wnome ;
/* exec sql end declare section */
#line 22 "teste.pgc"
p_sequencia = PG_GETARG_INT32(0);
/* declare WDados cursor for select cli . codcli , cli . nome from cliente cli
*/
#line 30 "teste.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "declare WDados cursor for select cli . codcli ,
cli . nome from cliente cli ", ECPGt_EOIT, ECPGt_EORT);}
#line 32 "teste.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next in WDados", ECPGt_EOIT,
ECPGt_int,&(wcodcli),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(wnome),(long)50,(long)1,sizeof(struct varchar_wnome),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 34 "teste.pgc"
if(sqlca.sqlcode != 0){
printf(" Erro executando a query. ");
printf("Descrição: %s ", sqlca.sqlerrm.sqlerrmc);
return -1;
}
while (sqlca.sqlcode == 0){
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next in WDados", ECPGt_EOIT,
ECPGt_int,&(wcodcli),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(wnome),(long)50,(long)1,sizeof(struct varchar_wnome),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 43 "teste.pgc"
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close WDados", ECPGt_EOIT, ECPGt_EORT);}
#line 46 "teste.pgc"
PG_RETURN_TEXT_P(wreturn);
}
Agradeço antecipadamente pela atenção de todos._______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral