Received: from server.radioactive.se (root@[193.14.161.104]) by hub.org (8.8.8/8.7.5) with ESMTP id MAA22223 for ; Fri, 17 Jul 1998 12:15:04 -0400 (EDT) Received: from noname4us.com (scp.radioactive.se [192.168.1.3]) by server.radioactive.se (8.8.5/8.8.5) with ESMTP id RAA18270 for ; Fri, 17 Jul 1998 17:15:04 +0200 Sender: root@server.radioactive.se Message-ID: <35AF78BB.E0301AA3@noname4us.com> Date: Fri, 17 Jul 1998 18:15:55 +0200 From: Stefan Olsson Organization: NoName4Us X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.34 i586) MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: Segmentation fault Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, i am testing PostgreSQL and have already run into questions... Can someone explain why i donīt get a error message the second time i run this program saying "TABLE slask ALREADY EXISTS", instead i get "Segmentation fault (core dumped)" Thanks ! /Stefan #include #include "libpq-fe.h" void exit_nicely(PGconn* conn) { PQfinish(conn); exit(1); } main() { char *pghost, *pgport, *pgoptions, *pgtty; char* dbName; PGconn* conn; PGresult* res; pghost = NULL; pgport = NULL; pgoptions = NULL; pgtty = NULL; dbName = "test"; conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); if (PQstatus(conn) == CONNECTION_BAD) { fprintf(stderr,"%s",PQerrorMessage(conn)); exit_nicely(conn); } // create the table res = PQexec(conn, "CREATE TABLE slask(name char(20), phone char(10))"); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr,"CREATE TABLE slask failed !"); PQclear(res); exit_nicely(conn); } PQclear(res); PQfinish(conn); }