Thread

  1. pgresStatus undefined in interfaces/libpgtcl/libpgtcl.a

    Brook Milligan <brook@trillium.nmsu.edu> — 1998-02-23T21:30:36Z

    Based on today's snapshot, the symbol _pgresStatus is still undefined
    in interfaces/libpgtcl/libpgtcl.a (actually from pgtclCmds.o).  The
    offending statement in pgtclCmds.c is:
    
    	if (strcmp(opt, "-status") == 0)
    	{
    		Tcl_AppendResult(interp, pgresStatus[PQresultStatus(result)], 0);
    		return TCL_OK;
    	}
    
    It seems like this symbol should refer to an array that is defined in
    interfaces/libpq/fe-exec.c (the symbol is declared extern in
    interfaces/libpq/libpq-fe.h which is included by pgtclCmds.c):
    
         /* keep this in same order as ExecStatusType in pgtclCmds.h */
         const char *pgresStatus[] = {
    	     "PGRES_EMPTY_QUERY",
    	     "PGRES_COMMAND_OK",
    	     "PGRES_TUPLES_OK",
    	     "PGRES_BAD_RESPONSE",
    	     "PGRES_NONFATAL_ERROR",
    	     "PGRES_FATAL_ERROR"
         };
    
    One solution is to place this segment of fe-exec.c into a distinct *.c
    file that is included by both interfaces/libpq/fe-exec.c and
    interfaces/libpgtcl/pgtclCmds.c.  Then the symbol would be included in
    the libraries as intended.
    
    However, the comment preceding the array definition suggests that
    perhaps something should be taken from pgtclCmds.h and the whole thing
    organized for sharing between the two directories.
    
    Other solutions may be obvious to those more enlightened on matters of
    the organization of this code.  As it stands, pgaccess is unusable
    because of the undefined symbol.
    
    Can anyone comment on the correct way to solve this problem?  I'll
    make the patch if that would help.
    
    Cheers,
    Brook