diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2002-04-24 05:24:00 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2002-04-24 05:24:00 +0000 |
commit | 3d726290c0b32ec1368ed5ba95d98bfb65214db6 (patch) | |
tree | 1c85466242912b7ff6013e03a96b6021954e0d97 /src/bin/psql/command.c | |
parent | 246f47fdf0c0cdf68a0709ff3042ab1a7d77d3a7 (diff) | |
download | postgresql-3d726290c0b32ec1368ed5ba95d98bfb65214db6.tar.gz postgresql-3d726290c0b32ec1368ed5ba95d98bfb65214db6.zip |
Remove traces of NAMEDATALEN and INDEX_MAX_KEYS from psql. Build buffers
dynamically with PQExpBuffer.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index a0d4a5ca1a4..eceecd7d26a 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.71 2002/03/27 19:16:13 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.72 2002/04/24 05:24:00 petere Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1433,14 +1433,16 @@ bool test_superuser(const char *username) { PGresult *res; - char buf[64 + NAMEDATALEN]; + PQExpBufferData buf; bool answer; if (!username) return false; - sprintf(buf, "SELECT usesuper FROM pg_user WHERE usename = '%.*s'", NAMEDATALEN, username); - res = PSQLexec(buf); + initPQExpBuffer(&buf); + printfPQExpBuffer(&buf, "SELECT usesuper FROM pg_user WHERE usename = '%s'", username); + res = PSQLexec(buf.data); + termPQExpBuffer(&buf); answer = (PQntuples(res) > 0 && PQnfields(res) > 0 |