summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2007-09-19 17:44:30 -0700
committerMark Wong <markwkm@gmail.com>2007-09-19 17:44:30 -0700
commitdec71b2173fb6096e61b62737b77591439010d71 (patch)
tree04e94f67e0a6ed33a16af7b028c01b26965ae110 /commands.c
parent9c1d13a8753164e8026a91f2f5097f4fc516b608 (diff)
Fixed the query to get locks held by a process and fixed the minimum
size of the column widths so the headers line up with the following data when the data is smaller than the headers.
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands.c b/commands.c
index b2a95ae..9a9352b 100644
--- a/commands.c
+++ b/commands.c
@@ -82,6 +82,7 @@ static char *err_listem =
"SELECT datname, relname, mode, granted\n" \
"FROM pg_stat_activity, pg_locks, pg_class\n" \
"WHERE procpid = %d\n" \
+ " AND procpid = pid\n" \
" AND pg_class.oid = relation;"
/*
@@ -537,7 +538,7 @@ show_locks(PGconn *pgconn, int procpid)
int rows;
char *sql;
char info[64];
- int width[5] = {0, 0, 0, 0, 0};
+ int width[5] = {1, 8, 5, 4, 7};
PGresult *pgresult;
char *header_format;
char *line_format;