Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite4d2817

Browse files
committed
Make psql's \sf and \ef honor ECHO_HIDDEN.
These commands were calling the database direct rather than callingPSQLexec like other slash commands that needed database data.The code is also changed not to pass the connection as a parameter tothe helper functions. It's available in a global variable, and that'swhat PSQLexec uses.
1 parent622983e commite4d2817

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

‎src/bin/psql/command.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ static bool do_edit(const char *filename_arg, PQExpBuffer query_buf,
6262
staticbooldo_connect(char*dbname,char*user,char*host,char*port);
6363
staticbooldo_shell(constchar*command);
6464
staticbooldo_watch(PQExpBufferquery_buf,longsleep);
65-
staticboollookup_function_oid(PGconn*conn,constchar*desc,Oid*foid);
66-
staticboolget_create_function_cmd(PGconn*conn,Oidoid,PQExpBufferbuf);
65+
staticboollookup_function_oid(constchar*desc,Oid*foid);
66+
staticboolget_create_function_cmd(Oidoid,PQExpBufferbuf);
6767
staticintstrip_lineno_from_funcdesc(char*func);
6868
staticvoidminimal_error_message(PGresult*res);
6969

@@ -611,12 +611,12 @@ exec_command(const char *cmd,
611611
"AS $function$\n"
612612
"\n$function$\n");
613613
}
614-
elseif (!lookup_function_oid(pset.db,func,&foid))
614+
elseif (!lookup_function_oid(func,&foid))
615615
{
616616
/* error already reported */
617617
status=PSQL_CMD_ERROR;
618618
}
619-
elseif (!get_create_function_cmd(pset.db,foid,query_buf))
619+
elseif (!get_create_function_cmd(foid,query_buf))
620620
{
621621
/* error already reported */
622622
status=PSQL_CMD_ERROR;
@@ -1215,12 +1215,12 @@ exec_command(const char *cmd,
12151215
psql_error("function name is required\n");
12161216
status=PSQL_CMD_ERROR;
12171217
}
1218-
elseif (!lookup_function_oid(pset.db,func,&foid))
1218+
elseif (!lookup_function_oid(func,&foid))
12191219
{
12201220
/* error already reported */
12211221
status=PSQL_CMD_ERROR;
12221222
}
1223-
elseif (!get_create_function_cmd(pset.db,foid,func_buf))
1223+
elseif (!get_create_function_cmd(foid,func_buf))
12241224
{
12251225
/* error already reported */
12261226
status=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
*/
29362936
staticbool
2937-
lookup_function_oid(PGconn*conn,constchar*desc,Oid*foid)
2937+
lookup_function_oid(constchar*desc,Oid*foid)
29382938
{
29392939
boolresult= true;
29402940
PQExpBufferquery;
29412941
PGresult*res;
29422942

29432943
query=createPQExpBuffer();
29442944
appendPQExpBufferStr(query,"SELECT ");
2945-
appendStringLiteralConn(query,desc,conn);
2945+
appendStringLiteralConn(query,desc,pset.db);
29462946
appendPQExpBuffer(query,"::pg_catalog.%s::pg_catalog.oid",
29472947
strchr(desc,'(') ?"regprocedure" :"regproc");
29482948

2949-
res=PQexec(conn,query->data);
2949+
res=PSQLexec(query->data);
29502950
if (PQresultStatus(res)==PGRES_TUPLES_OK&&PQntuples(res)==1)
29512951
*foid=atooid(PQgetvalue(res,0,0));
29522952
else
@@ -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
*/
29682968
staticbool
2969-
get_create_function_cmd(PGconn*conn,Oidoid,PQExpBufferbuf)
2969+
get_create_function_cmd(Oidoid,PQExpBufferbuf)
29702970
{
29712971
boolresult= true;
29722972
PQExpBufferquery;
@@ -2975,7 +2975,7 @@ get_create_function_cmd(PGconn *conn, Oid oid, PQExpBuffer buf)
29752975
query=createPQExpBuffer();
29762976
printfPQExpBuffer(query,"SELECT pg_catalog.pg_get_functiondef(%u)",oid);
29772977

2978-
res=PQexec(conn,query->data);
2978+
res=PSQLexec(query->data);
29792979
if (PQresultStatus(res)==PGRES_TUPLES_OK&&PQntuples(res)==1)
29802980
{
29812981
resetPQExpBuffer(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp