@@ -62,8 +62,8 @@ static bool do_edit(const char *filename_arg, PQExpBuffer query_buf,
6262static bool do_connect (char * dbname ,char * user ,char * host ,char * port );
6363static bool do_shell (const char * command );
6464static bool do_watch (PQExpBuffer query_buf ,long sleep );
65- static bool lookup_function_oid (PGconn * conn , const char * desc ,Oid * foid );
66- static bool get_create_function_cmd (PGconn * conn , Oid oid ,PQExpBuffer buf );
65+ static bool lookup_function_oid (const char * desc ,Oid * foid );
66+ static bool get_create_function_cmd (Oid oid ,PQExpBuffer buf );
6767static int strip_lineno_from_funcdesc (char * func );
6868static void minimal_error_message (PGresult * res );
6969
@@ -611,12 +611,12 @@ exec_command(const char *cmd,
611611"AS $function$\n"
612612"\n$function$\n" );
613613}
614- else if (!lookup_function_oid (pset . db , func ,& foid ))
614+ else if (!lookup_function_oid (func ,& foid ))
615615{
616616/* error already reported */
617617status = PSQL_CMD_ERROR ;
618618}
619- else if (!get_create_function_cmd (pset . db , foid ,query_buf ))
619+ else if (!get_create_function_cmd (foid ,query_buf ))
620620{
621621/* error already reported */
622622status = PSQL_CMD_ERROR ;
@@ -1215,12 +1215,12 @@ exec_command(const char *cmd,
12151215psql_error ("function name is required\n" );
12161216status = PSQL_CMD_ERROR ;
12171217}
1218- else if (!lookup_function_oid (pset . db , func ,& foid ))
1218+ else if (!lookup_function_oid (func ,& foid ))
12191219{
12201220/* error already reported */
12211221status = PSQL_CMD_ERROR ;
12221222}
1223- else if (!get_create_function_cmd (pset . db , foid ,func_buf ))
1223+ else if (!get_create_function_cmd (foid ,func_buf ))
12241224{
12251225/* error already reported */
12261226status = PSQL_CMD_ERROR ;
@@ -2934,19 +2934,19 @@ do_watch(PQExpBuffer query_buf, long sleep)
29342934 * unfortunately it can be hard to tell the difference.
29352935 */
29362936static bool
2937- lookup_function_oid (PGconn * conn , const char * desc ,Oid * foid )
2937+ lookup_function_oid (const char * desc ,Oid * foid )
29382938{
29392939bool result = true;
29402940PQExpBuffer query ;
29412941PGresult * res ;
29422942
29432943query = createPQExpBuffer ();
29442944appendPQExpBufferStr (query ,"SELECT " );
2945- appendStringLiteralConn (query ,desc ,conn );
2945+ appendStringLiteralConn (query ,desc ,pset . db );
29462946appendPQExpBuffer (query ,"::pg_catalog.%s::pg_catalog.oid" ,
29472947strchr (desc ,'(' ) ?"regprocedure" :"regproc" );
29482948
2949- res = PQexec ( conn , query -> data );
2949+ res = PSQLexec ( query -> data );
29502950if (PQresultStatus (res )== PGRES_TUPLES_OK && PQntuples (res )== 1 )
29512951* foid = atooid (PQgetvalue (res ,0 ,0 ));
29522952else
@@ -2966,7 +2966,7 @@ lookup_function_oid(PGconn *conn, const char *desc, Oid *foid)
29662966 * function with the given OID. If successful, the result is stored in buf.
29672967 */
29682968static bool
2969- get_create_function_cmd (PGconn * conn , Oid oid ,PQExpBuffer buf )
2969+ get_create_function_cmd (Oid oid ,PQExpBuffer buf )
29702970{
29712971bool result = true;
29722972PQExpBuffer query ;
@@ -2975,7 +2975,7 @@ get_create_function_cmd(PGconn *conn, Oid oid, PQExpBuffer buf)
29752975query = createPQExpBuffer ();
29762976printfPQExpBuffer (query ,"SELECT pg_catalog.pg_get_functiondef(%u)" ,oid );
29772977
2978- res = PQexec ( conn , query -> data );
2978+ res = PSQLexec ( query -> data );
29792979if (PQresultStatus (res )== PGRES_TUPLES_OK && PQntuples (res )== 1 )
29802980{
29812981resetPQExpBuffer (buf );