Commit Graph

58 Commits

Author SHA1 Message Date
Neil Conway 077811605e Per discussion on -hackers, this patch changes psql's "expanded" output
mode to only affect the presentation of normal query results, not the
output of psql slash commands. Documentation updated. I also made
some unrelated minor psql cleanup. Per suggestion from Stuart Cooper.
2005-06-13 06:36:22 +00:00
Bruce Momjian 5c4955981e \(rs should be \\(rs, per Tom. 2005-06-09 18:40:06 +00:00
Bruce Momjian 4a5cda7bba I've created a patch which adds support for troff "-ms" output to
psql.  i.e. "\pset format troff-ms".  The patch also corrects some
problems with the "latex" format, notably defining an extra column in
the output table, and correcting some alignment issues; it also
changes the output to match the border setting as documented in the
manual page and as shown with the "aligned" format.

The troff-ms output is mostly identical to the latex output allowing
for the differences between the two typesetters.

The output should be saved in a file and piped as follows:

  cat file | tbl | troff -T ps -ms > file.ps
or
  tbl file | troff -T ps -ms > file.ps

Because it contains tabs, you'll need to redirect psql output or use
"script", rather than pasting from a terminal window, due to the tabs
which can be replaced with spaces.

Roger Leigh
2005-06-09 15:27:27 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
Bruce Momjian 2daed8c5b3 Update copyrights that were missed. 2005-01-01 05:43:09 +00:00
Peter Eisentraut e9c05281b5 Get rid of perror(), substitute some better phrased error messages.
malloc() doesn't set errno, so most uses were buggy anyway.
2004-11-09 15:57:57 +00:00
Bruce Momjian e1c8b37afb Add new macro as shorthand for MS VC and Borland C++:
+ #if   defined(_MSC_VER) || defined(__BORLANDC__)
+ #define       WIN32_CLIENT_ONLY
+ #endif
2004-09-27 23:24:45 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Bruce Momjian da9a8649d8 Update copyright to 2004. 2004-08-29 04:13:13 +00:00
Bruce Momjian d6e05afc3d I have noticed that the latex format in psql has some bugs:
o "_" is not escaped, and causes TeX to abort, thinking it's a
  subscript outside of maths mode.  Most of my table and field names
  use underscores, so this is a really nasty one.
o The column count is calculated using the contents of opt_align. But
  opt_align has one extra element, and so it's always one too many.  I
  changed it to count the column headings, like all the other output
  formats.  There may be a bug in computing opt_align that this patch
  does not address, but I'm not yet familiar enough with the psql
  source to fix this as well.
o  The line drawing rules for each border setting (0-3) and expanded
  mode didn't always match the documented behaviour and what other
  formats (e.g. aligned) did.  I made it as conformant as possible,
  and also tidied the alignment of the first line of the footer, which
  was incorrectly indented.

Roger Leigh
2004-08-06 18:09:15 +00:00
Neil Conway 256d4639c9 A few cosmetic fixes and code cleanup. 2004-05-23 22:20:10 +00:00
Bruce Momjian a9fad44372 Move find_my_exec() way up into main.c so it is available to the
timezone code and other places.

Remove elog() calls from find_my_exec;  do fprintf(stderr) instead.  We
can then remove the exec.c handling in the makefile because it doesn't
have to be built to suppress elog calls.
2004-05-18 20:18:59 +00:00
Neil Conway 6f046b9d9f Revert the change to print.c, as this breaks src/bin/scripts. The proper
way to fix this is probably implementing safe memory handling functions
once in a static lib and then using that in the various client apps,
but for the moment I've just reverted the change to un-break the tree.
2004-01-24 20:43:26 +00:00
Neil Conway 610d33c194 This patch makes some of the memory manipulation performed by psql a
little more sane. Some parts of the code was using a static function
xmalloc() that did safe memory allocation (where "safe" means "bail
out on OOM"), but most of it was just invoking calloc() or malloc()
directly. Now almost everything invokes xmalloc() or xcalloc().
2004-01-24 19:38:49 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Tom Lane 80cedf9ba0 Someone moved PageOutput here from common.c, but forgot to move all
the #includes it depends on.
2003-08-14 18:49:42 +00:00
Tom Lane 2f9c859ea1 Fix some copyright notices that weren't updated. Improve copyright tool
so it won't miss 'em again.
2003-08-04 23:59:41 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Bruce Momjian ad73f6b86f Update copyrights to 2003.
print.c: Add one more line to pager calculation to account for the prompt.
help.c: Call PageOutput with correct number of lines within slashUsage
        Add one to line count in helpSQL to account for "Available help:" line.
        Make copyright match COPYRIGHT file. (Just "1994")

Greg Sabino Mullane
2003-07-25 21:48:45 +00:00
Bruce Momjian b14295cfe4 Attached is the complete diff against current CVS.
Compiles on BCC 5.5 and VC++ 6.0 (with warnings).

Karl Waclawek
2003-06-12 08:15:29 +00:00
Bruce Momjian ef2ba42717 Attached is a patch that enhances the output of psql's HTML mode.
The output now validates as HTML 4.01 Strict, XHTML 1.0 strict,
and XHTML 1.1 (assuming you wrap it in a valid html/body document).

It also wraps the output of PGRES_COMMAND_OK if the HTML tag is on,
for full compliance: this is why html_escaped_print has to be
externalized.

Greg Sabino Mullane greg@turnstep.com
2003-06-12 07:52:51 +00:00
Tom Lane 9c264975d5 Fix some signed-vs-unsigned-int issues; make print_aligned_vertical
safe for zero-column tables.
2003-04-04 15:48:38 +00:00
Peter Eisentraut cf1cf89649 Make the printing code somewhat more independent by not relying on
functions and global variables from the rest of psql.  Also clean up some
data type mismatches created by the last pager patch.
2003-03-18 22:15:44 +00:00
Tom Lane 16cc5372e4 Avoid malloc(0) when printing a table of no columns. On some platforms
this returns NULL, which confuses the code.
2002-11-01 15:12:19 +00:00
Bruce Momjian b093f8825d Fix include files for new PageOutput call. 2002-10-24 01:33:50 +00:00
Bruce Momjian 641b658c26 Page \h output and centralize psql paging code in PageOutput(). 2002-10-23 19:23:57 +00:00
Bruce Momjian a0bf2503ea The attached patch fixes a number of issues related to compiling the
client
utilities (libpq.dll and psql.exe) for win32 (missing defines,
adjustments to
includes, pedantic casting, non-existent functions) per:
   http://developer.postgresql.org/docs/postgres/install-win32.html.

It compiles cleanly under Windows 2000 using Visual Studio .net. Also
compiles clean and passes all regression tests (regular and contrib)
under Linux.

In addition to a review by the usual suspects, it would be very
desirable for  someone well versed in the peculiarities of win32 to take
a look.

Joe Conway
2002-10-03 17:09:42 +00:00
Bruce Momjian dd1dcf2362 Improve footer length computation for psql.
Greg Sabino Mullan
2002-09-01 23:30:46 +00:00
Bruce Momjian 81dfa2ce43 backend where a statically sized buffer is written to. Most of these
should be pretty safe in practice, but it's probably better to be safe
than sorry.

I was actually looking for cases where NAMEDATALEN is assumed to be
32, but only found one. That's fixed too, as well as a few bits of
code cleanup.

Neil Conway
2002-08-28 20:46:24 +00:00
Peter Eisentraut 7292131c66 Enable locale, so case conversion (identifier processing) and number
formatting (\timing) works correctly.  Change "Total time" to "Time"
since there is nothing that "total" refers to.  Remove non-multibyte
code.
2002-08-27 20:16:49 +00:00
Bruce Momjian 8c26bc5364 The attached patch fixes a tiny memory leak in psql, when using
the 'expanded' output mode (\x).

Neil Conway
2002-07-18 04:46:24 +00:00
Bruce Momjian 91dfa1af97 Fix \? and \pset pager handling. \? wasn't honoring pager before. 2002-07-15 01:56:25 +00:00
Tom Lane 6260c7c167 Don't dump core on empty table. 2002-04-24 15:56:38 +00:00
Bruce Momjian c41b6b1b9c Fix small problem Tom Lane found with pgindent run. 2001-10-30 05:38:56 +00:00
Tatsuo Ishii f2a2ad59bc Fix bug with illegal call to calloc. 2001-10-29 06:45:32 +00:00
Bruce Momjian b81844b173 pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
2001-10-25 05:50:21 +00:00
Tatsuo Ishii df4cba68cf Commit Patrice's patches except:
> - corrects a bit the UTF-8 code from Tatsuo to allow Unicode 3.1
>  characters (characters with values >= 0x10000, which are encoded on
>  four bytes).

Also, update mb/expected/unicode.out. This is necessary since the
patches affetc the result of queries using UTF-8.
---------------------------------------------------------------
Hi,

I should have sent the patch earlier, but got delayed by other stuff.
Anyway, here is the patch:

- most of the functionality is only activated when MULTIBYTE is
  defined,

- check valid UTF-8 characters, client-side only yet, and only on
  output, you still can send invalid UTF-8 to the server (so, it's
  only partly compliant to Unicode 3.1, but that's better than
  nothing).

- formats with the correct number of columns (that's why I made it in
  the first place after all), but only for UNICODE. However, the code
  allows to plug-in routines for other encodings, as Tatsuo did for
  the other multibyte functions.

- corrects a bit the UTF-8 code from Tatsuo to allow Unicode 3.1
  characters (characters with values >= 0x10000, which are encoded on
  four bytes).

- doesn't depend on the locale capabilities of the glibc (useful for
  remote telnet).

I would like somebody to check it closely, as it is my first patch to
pgsql.  Also, I created dummy .orig files, so that the two files I
created are included, I hope that's the right way.

Now, a lot of functionality is NOT included here, but I will keep that
for 7.3 :) That includes all string checking on the server side (which
will have to be a bit more optimised ;) ), and the input checking on
the client side for UTF-8, though that should not be difficult. It's
just to send the strings through mbvalidate() before sending them to
the server. Strong checking on UTF-8 strings is mandatory to be
compliant with Unicode 3.1+ .

Do I have time to look for a patch to include iso-8859-15 for 7.2 ?
The euro is coming 1. january 2002 (before 7.3 !) and over 280
millions people in Europe will need the euro sign and only iso-8859-15
and iso-8859-16 have it (and unfortunately, I don't think all Unices
will switch to Unicode in the meantime)....

err... yes, I know that this is not every single person in Europe that
uses PostgreSql, so it's not exactly 280m, but it's just a matter of
time ! ;)

I'll come back (on pgsql-hackers) later to ask a few questions
regarding the full unicode support (normalisation, collation,
regexes,...) on the server side :)

Here is the patch !

Patrice.

--
Patrice HÉDÉ ------------------------------- patrice à islande org -----
  --  Isn't it weird  how scientists  can imagine  all the matter of the
universe exploding out of a dot smaller than the head of a pin, but they
can't come up with a more evocative name for it than "The Big Bang" ?
  -- What would _you_ call the creation of the universe ?
  -- "The HORRENDOUS SPACE KABLOOIE !"               - Calvin and Hobbes
------------------------------------------ http://www.islande.org/ -----
2001-10-15 01:25:10 +00:00
Bruce Momjian ea72cc4e11 Attached ia a patch to enable window size detection code of psql for Solaris
platform.

TIOCGWINSZ is defined as follows:

    Linux       asm/ioctls.h
    FreeBSD     sys/ttycom.h. This file is included by sys/ioctl.h.
    Solaris     sys/termios.h

This patch tells print.c to know TIOCGWINSZ on Solaris platform. Same code is
founded in src/bin/psal/common.c.

Kenji Sugita
2001-08-01 18:44:54 +00:00
Peter Eisentraut e542036461 Native Language Support (NLS)
Use --enable-nls to turn it on; see installation instructions for details.
See developer's guide how to make use of it in programs and how to add
translations.

psql sources have been almost fully prepared and an incomplete German
translation has been provided.  In the backend, only elog() calls are
currently translatable, and the provided German translation file is more
of a placeholder.
2001-06-02 18:25:18 +00:00
Peter Eisentraut b3f66d1980 Add command '\pset footer' to psql to turn off default "(x rows)" footer. 2001-05-12 19:44:46 +00:00
Bruce Momjian 9e1552607a pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
Peter Eisentraut 653cd3e38e Fix memory leak. 2001-03-01 18:52:50 +00:00
Tatsuo Ishii df247b821d Massive commits for SunOS4 port. 2001-02-27 08:13:31 +00:00
Tom Lane d08741eab5 Restructure the key include files per recent pghackers discussion: there
are now separate files "postgres.h" and "postgres_fe.h", which are meant
to be the primary include files for backend .c files and frontend .c files
respectively.  By default, only include files meant for frontend use are
installed into the installation include directory.  There is a new make
target 'make install-all-headers' that adds the whole content of the
src/include tree to the installed fileset, for use by people who want to
develop server-side code without keeping the complete source tree on hand.
Cleaned up a whole lot of crufty and inconsistent header inclusions.
2001-02-10 02:31:31 +00:00
Bruce Momjian 312063c97b Make pgsql compile on FreeBSD-alpha.
Context diff this time.

Remove -m486 compile args for FreeBSD-i386, compile -O2 on i386.

Compile with only -O on alpha for codegen safety.

Make the port use the TEST_AND_SET for alpha and i386 on FreeBSD.

Fix a lot of bogus string formats for outputting pointers (cast to int
and %u/%x replaced with no cast and %p), and 'Size'(size_t) are now
cast to 'unsigned long' and output with %lu/

Remove an unused variable.

Alfred Perlstein
2000-11-16 05:51:07 +00:00
Bruce Momjian 52f77df613 Ye-old pgindent run. Same 4-space tabs. 2000-04-12 17:17:23 +00:00
Bruce Momjian 78693c89d7 Clean up include files use in psql. 2000-02-16 13:15:26 +00:00
Bruce Momjian ecd8537376 I checked the WinNT port yesterday (a few days old snapshot from CVS) and I
am including a patch to get it compile.

changes to psql:
- added less as default pager when compiling on Cygwin
- need to declare "filename_completion_function" because it is not exported
from readline -> added to include/port/win.h

changes to pg_id:
- include of <getopt.h>
- add .exe when installing

I think there is a problem with calling the regress tests on WinNT - it
should be called with PORTNAME not HOST as the parameter to regress.sh or
the check  when to add "-h localhost" to psql has to be changed. Now it is
checked against the PORTNAME.

The results of the regress tests were OK with expected failures ;-)

Daniel Horak
2000-02-09 16:23:44 +00:00
Peter Eisentraut 9ceb5d8a7b Fixed psql double quoting of SQL ids
Fixed libpq printing functions
2000-02-07 23:10:11 +00:00
Peter Eisentraut 2b84cbb60f A few minor psql enhancements
Initdb help correction
Changed end/abort to commit/rollback and changed related notices
Commented out way old printing functions in libpq
Fixed a typo in alter table / alter column
2000-01-29 16:58:54 +00:00