I have upgraded from 6.2 to 6.5.1. As my 6.2 dumpall command would not run
(segfault) I had to backup & restore my data manually using select and insert
statements. The process appears to have worked correctly.
I have three tables in our database, accounts, history and timelog.
I restored data into the accounts and the history table, and just recreated
the timelog table. (which is filled from our radius logs - more on this later)
When I upgraded from 6.2 to 6.5.1 I did have to recompile all of my programs
before they would work with 6.5.1 (I assume because they are linked against
the Db code somehow). I use the /usr/local/pgsql/lib/libpq.a file with my
programs (written in C).
I have several programs, all of which are not working except one.
The one program that I'm having errors with is the one that scans data from
my radius (login) logs and places it into the timelog table.
I traced the problem to a specific INSERT statement, and I did a printf of
this insert statement, hopeing to spot a problem. Unfortunatally, I didn't
see anything obvious. I even cut&pasted the same insert statement into the
psql tool, and it worked just fine, which makes me wonder why it's not
working in my code.
Here is the code that produces the error:
/* Make entry into timelog table */
/* build the query string */
/* INSERT into timelog values (...stuff...); */
strcpy(query,"INSERT INTO timelog VALUES ('");
strcat(query,username);
strcat(query,"', '");
strcat(query,ip);
strcat(query,"', '");
strcat(query, portmaster);
strcat(query,"', '");
itoa(port,number);
strcat(query,number);
strcat(query,"', '");
strcat(query, time);
strcat(query,"', '");
strcat(query,datetime);
strcat(query,"', '0:0:0', '01/10/77', '0', '"); /* fill in blanks */
strcat(query,sessionid);
strcat(query,"' );"); /* end the string */
printf("%s\n",query); /* for testing */
/* execute the query */
res = PQexec(conn,query);
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
PQclear(res);
PQfinish(conn); /* close connection */
printf("ERROR:3445\n");
exit();
}
I get error 3445 when I attempt to run this.
an example query that works ok in psql but not when using the
PQexec function follows:
INSERT INTO timelog VALUES ('jonbbq', '205.139.116.215', '205.139.116.203',
'4', '22:26:25 ^D', 'Mon Aug 30 22:26:25 1999', '0:0:0', '01/10/77', '0',
'4A0027C2' );
ERROR:3445
I thought that the problem might be that ^D after the time, but when I pasted
this line into psql it worked just fine.
Keep in mind, this program worked correctly with version 6.2, and all of my
other programs work as they should still.
My question: Can anybody spot my problem right off? If not, what code should
I use to report the actual error message generated by the backend
(as opposed to just detecting that an error has occured as I do now)?.
Thanks,
Jay Summet
************