summaryrefslogtreecommitdiff
path: root/src/bin/psql/print.c
AgeCommit message (Collapse)Author
2011-11-12Add psql expanded auto modePeter Eisentraut
This adds the "auto" option to the \x command, which switches to the expanded mode when the normal output would be wider than the screen. reviewed by Noah Misch
2011-09-11Remove many -Wcast-qual warningsPeter Eisentraut
This addresses only those cases that are easy to fix by adding or moving a const qualifier or removing an unnecessary cast. There are many more complicated cases remaining.
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-11-14Cleanup various comparisons with the constant "true".Robert Haas
Itagaki Takahiro, with slight modifications.
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-07-06pgindent run for 9.0, second runBruce Momjian
2010-05-09Suppress signed-vs-unsigned-char warning.Tom Lane
2010-05-09Adjust comments about avoiding use of printf's %.*s.Tom Lane
My initial impression that glibc was measuring the precision in characters (which is what the Linux man page says it does) was incorrect. It does take the precision to be in bytes, but it also tries to truncate the string at a character boundary. The bottom line remains the same: it will mess up if the string is not in the encoding it expects, so we need to avoid %.*s anytime there's a significant risk of that. Previous code changes are still good, but adjust the comments to reflect this knowledge. Per research by Hernan Gonzalez.
2010-05-08Work around a subtle portability problem in use of printf %s format.Tom Lane
Depending on which spec you read, field widths and precisions in %s may be counted either in bytes or characters. Our code was assuming bytes, which is wrong at least for glibc's implementation, and in any case libc might have a different idea of the prevailing encoding than we do. Hence, for portable results we must avoid using anything more complex than just "%s" unless the string to be printed is known to be all-ASCII. This patch fixes the cases I could find, including the psql formatting failure reported by Hernan Gonzalez. In HEAD only, I also added comments to some places where it appears safe to continue using "%.*s".
2010-03-01Fix translation of strings in psql \d output (translation in headers worked,Heikki Linnakangas
but not in cells).
2010-03-01Fix numericlocale psql option when used with a null string and latex and troffHeikki Linnakangas
formats; a null string must not be formatted as a numeric. The more exotic formats latex and troff also incorrectly formatted all strings as numerics when numericlocale was on. Backpatch to 8.1 where numericlocale option was added. This fixes bug #5355 reported by Andy Lester.
2010-02-26pgindent run for 9.0Bruce Momjian
2010-01-30Fix memory leakage introduced into print_aligned_text by 8.4 changesTom Lane
(failure to free col_lineptrs[] array elements) and exacerbated in the current devel cycle (failure to free "wrap"). This resulted in moderate bloat of psql over long script runs. Noted while testing bug #5302, although what the reporter was complaining of was backend-side leakage.
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-11-25Simplify psql's new linestyle behavior to default to linestyle=ascii allTom Lane
the time, rather than hoping we can tell whether the terminal supports UTF8 characters. Per discussion.
2009-11-22Improve psql's tabular display of wrapped-around data by inserting markersTom Lane
in the formerly-always-blank columns just to left and right of the data. Different marking is used for a line break caused by a newline in the data than for a straight wraparound. A newline break is signaled by a "+" in the right margin column in ASCII mode, or a carriage return arrow in UNICODE mode. Wraparound is signaled by a dot in the right margin as well as the following left margin in ASCII mode, or an ellipsis symbol in the same places in UNICODE mode. "\pset linestyle old-ascii" is added to make the previous behavior available if anyone really wants it. In passing, this commit also cleans up a few regression test files that had unintended spacing differences from the current actual output. Roger Leigh, reviewed by Gabrielle Roth and other members of PDXPUG.
2009-10-13Add "\pset linestyle ascii/unicode" option to psql, allowing our traditionalTom Lane
ASCII-art style of table output to be upgraded to use Unicode box drawing characters if desired. By default, psql will use the Unicode characters whenever client_encoding is UTF8. The patch forces linestyle=ascii in pg_regress usage, ensuring we don't break the regression tests in Unicode locales. Roger Leigh
2009-06-12Fix several places where a function was declared static and then definedTom Lane
without static. Per testing with a compiler that complains about this.
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-06-04Trivial code style cleanup around a couple of ngettext calls.Tom Lane
2009-05-27Fix to use the same format specifiers in both branches of a ngettext().Peter Eisentraut
Zdenek Kotala
2009-04-11Message fixPeter Eisentraut
(I guess this was a cruise replace mistake.)
2009-03-26Gettext plural supportPeter Eisentraut
In the backend, I changed only a handful of exemplary or important-looking instances to make use of the plural support; there is probably more work there. For the rest of the source, this should cover all relevant cases.
2009-01-01Update copyright for 2009.Bruce Momjian
2008-07-14In psql, rename trans_* variables to translate_*, for clarity.Bruce Momjian
2008-05-21Fix function headers not matching prototype in header file, perMagnus Hagander
compiler warnings on msvc.
2008-05-18Remove old kluge put in to allow Windows regression tests to succeed, and nowAndrew Dunstan
found to have been made necessary by our skipping tty detection on Windows. Now that we are doing tty detection on Windows the kluge is unnecessary and wrong.
2008-05-17Use isatty() test for pager on Win32; not sure why it was disabled forBruce Momjian
that platform.
2008-05-17In psql, test for output to stdout when forcing pager for wide output.Bruce Momjian
2008-05-17Fix utterly-bogus code for computing row heights. Per crashes onTom Lane
spoonbill, though one wonders why it didn't misbehave everywhere. In passing remove some unnecessary modulo calculations.
2008-05-16Recent patch doesn't compile without <limits.h>Tom Lane
2008-05-16Add detection of psql pager to trigger on wide output. Also add pagerBruce Momjian
detection for wrapped lines or lines with newlines that need pager to display.
2008-05-13Fix a bug in the previous patch, which caused the title pointer to be usedAlvaro Herrera
before it was actually set.
2008-05-12Improve psql's internal print.c code by introducing an actual print API.Alvaro Herrera
Provides for better code readability, but mainly this is infrastructure changes to allow further changes such as arbitrary footers on printed tables. Also, the translation status of each element in the table is more easily customized. Brendan Jurd, with some editorialization by me.
2008-05-10Restore psql's former behavior that padding spaces to the right of the lastTom Lane
output column are not emitted. (That change already caused more noise in the regression test output files than I would like.) Provide some needed editorial help for comments, clean up code formatting.
2008-05-08Add psql '\pset format wrapped' mode to wrap output to screen width, orBruce Momjian
file/pipe output too if \pset columns' is set. Bryce Nesbitt
2008-03-27Reduce the need for frontend programs to include "postgres.h" by refactoringTom Lane
inclusions in src/include/catalog/*.h files. The main idea here is to push function declarations for src/backend/catalog/*.c files into separate headers, rather than sticking them into the corresponding catalog definition file as has been done in the past. This commit only carries out that idea fully for pg_proc, pg_type and pg_conversion, but that's enough for the moment --- if pg_list.h ever becomes unsafe for frontend code to include, we'll need to work a bit more. Zdenek Kotala
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-12-12Improve the method of localizing column names and other fixed strings inTom Lane
psql's \d commands and other uses of printQuery(). Previously we would pass these strings through gettext() and then send them to the server as literals in the SQL query. But the code was not set up to handle doubling of quotes in the strings, causing failure if a translation attempted to use the wrong kind of quote marks, as indeed is now the case for (at least) the French translation of \dFp. Another hazard was that gettext() would translate to whatever encoding was implied by the client's LC_CTYPE setting, which might be different from the client_encoding setting, which would probably cause the server to reject the query as mis-encoded. The new arrangement is to send the untranslated ASCII strings to the server, and do the translations inside printQuery() after the query results come back. Per report from Guillaume Lelarge and subsequent discussion.
2007-11-22Add more comments about thousands separator handling.Bruce Momjian
2007-11-22Add comments about thousands separator logic.Bruce Momjian
2007-11-21When setting default thousands separator when locale has "", use logicBruce Momjian
so new thousands separator doesn't match decimal symbol.
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-08-29Create a FETCH_COUNT parameter that causes psql to execute SELECT-likeTom Lane
queries via a cursor, fetching a limited number of rows at a time and therefore not risking exhausting memory. A disadvantage of the scheme is that 'aligned' output mode will align each group of rows independently leading to odd-looking output, but all the other output formats work reasonably well. Chris Mair, with some additional hacking by moi.
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-06-14Clean up psql's control-C handling to avoid longjmp'ing out of randomTom Lane
places --- that risks corrupting data structures, losing sync with the backend, etc. We now longjmp only from calls to readline, fgets, and fread, which we assume are coded to protect themselves against interrupts at undesirable times. This requires adding explicit tests for cancel_pressed in long-running loops, but on the whole it's far cleaner. Martijn van Oosterhout and Tom Lane.
2006-06-07Prepare code to be built by MSVC:Bruce Momjian
o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-02-18&apos; is not valid HTML 4.01, so print the plain character instead.Peter Eisentraut