From: Raymond Toy Date: Tue, 05 Mar 1996 13:19:24 -0500 Subject: [PG95]: Disable PAGER if ntuples is small and make bug I normally have the PAGER enviroment variable set so psql always passes the output of a query through my PAGER. When the number of tuples is small, I find this quite annoying. Here is a simple patch that will only run the PAGER if the number of tuples to display is large enough. (In this case, it's hardwired to 20.) This also brings up a bug in the Makefiles for the programs like psql and monitor that use libpq. When libpq is changed (for example, after applying the path), psql and monitor are not re-linked with the new library. psql and monitor should have dependencies on libpq. Basically this means that postgres.prog.mk should have the folloing change made: $(PROG): $(addprefix $(objdir)/,$(PROGOBJS)) to $(PROG): $(addprefix $(objdir)/,$(PROGOBJS)) -lpq Thanks for the great database! Ray PAGER patch: - --- fe-exec.c~ Tue Feb 27 16:26:06 1996 +++ fe-exec.c Tue Mar 5 12:35:08 1996 @@ -652,9 +652,14 @@ if (fieldSep == NULL) fieldSep == DEFAULT_FIELD_SEP; + /* Get some useful info about the results */ + nFields = PQnfields(res); + nTuples = PQntuples(res); + if (fp == NULL) fp = stdout; - - if (fp == stdout) { + /* Use the pager only if the number of tuples is big enough */ + if ((nTuples > 20) && (fp == stdout)) { /* try to pipe to the pager program if possible */ pager=getenv("PAGER"); if (pager != NULL) { @@ -667,10 +672,6 @@ } } - - /* Get some useful info about the results */ - - nFields = PQnfields(res); - - nTuples = PQntuples(res); - - /* Zero the initial field lengths */ for (j=0 ; j < nFields; j++) { fLength[j] = strlen(PQfname(res,j));