psql Week 3

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql Week 3
Date: 1999-10-19 19:41:55
Message-ID: Pine.LNX.4.10.9910192107580.981-100000@peter-e.yi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

For external reasons I didn't get as much done as I wanted. Originally, I
planned for 4 weeks and I think I can keep that.

The source is posted at http://www.pathwaynet.com/~peter/psql3.tar.gz

CHANGELOG
* Accommodated object descriptions in \d* commands.
* Re-wrote \dd
* Re-wrote \d "table"
* \pset command as generic way for setting printing options (e.g.,
\pset format html, \pset null "(null)")
* Proliferated use of const char * and enums
* Rewrote \di, \dt, \ds, \dS. Say hello to \dv for views, which are
now recognized correctly. You can also call, e.g., \dtvi for a list
of indices, tables, and views. The possibilities are endless ...
(where "endless" = 325)

Also I wrote new printing routines which are better abstracted so that one
could easily throw in new formats. Here are some examples. Let me know if
you hate them.

(Sorry that this is a little long.)

peter(at)localhost:5432 play=> \pset format aligned
peter(at)localhost:5432 play=> \pset border 0
peter(at)localhost:5432 play=> select * from foo;
first second
-------- ------------
2
0 -----
0 hi
34
-1 -2
yo &&& <> ho
99999999 this is text
(7 rows)
peter(at)localhost:5432 play=> \pset border 1
peter(at)localhost:5432 play=> select * from foo;
first | second
----------+--------------
2 |
0 | -----
0 | hi
34 |
-1 | -2
| yo &&& <> ho
99999999 | this is text
(7 rows)
peter(at)localhost:5432 play=> \pset border 2
peter(at)localhost:5432 play=> select * from foo;
+----------+--------------+
| first | second |
+----------+--------------+
| 2 | |
| 0 | ----- |
| 0 | hi |
| 34 | |
| -1 | -2 |
| | yo &&& <> ho |
| 99999999 | this is text |
+----------+--------------+
(7 rows)
peter(at)localhost:5432 play=> \pset format unaligned
peter(at)localhost:5432 play=> \pset fieldsep ",,"
peter(at)localhost:5432 play=> select * from foo;
first,,second
2,,
0,,-----
0,,hi
34,,
-1,,-2
,,yo &&& <> ho
99999999,,this is text
(7 rows)
peter(at)localhost:5432 play=> \t
Turned on only tuples
peter(at)localhost:5432 play=> \x
Turned on expanded table representation
peter(at)localhost:5432 play=> select * from foo;

first,,2
second,,

first,,0
second,,-----

first,,0
second,,hi

first,,34
second,,

first,,-1
second,,-2

first,,
second,,yo &&& <> ho

first,,99999999
second,,this is text
peter(at)localhost:5432 play=> \pset border 1
peter(at)localhost:5432 play=> \pset format html
peter(at)localhost:5432 play=> \pset expanded
Turned off expanded display
peter(at)localhost:5432 play=> select * from foo;
<table border=1>
<tr valign=top>
<td align=right>2</td>
<td align=left>&nbsp;</td>
</tr>
<tr valign=top>
<td align=right>0</td>
<td align=left>-----</td>
</tr>
<tr valign=top>
<td align=right>0</td>
<td align=left>hi</td>
</tr>
<tr valign=top>
<td align=right>34</td>
<td align=left>&nbsp;</td>
</tr>
<tr valign=top>
<td align=right>-1</td>
<td align=left>-2</td>
</tr>
<tr valign=top>
<td align=right>&nbsp;</td>
<td align=left>yo &amp;&amp;&amp; &lt;&gt; ho</td>
</tr>
<tr valign=top>
<td align=right>99999999</td>
<td align=left>this is text</td>
</tr>
</table>
peter(at)localhost:5432 play=> \t
Turned off only tuples
peter(at)localhost:5432 play=> \pset border 2
peter(at)localhost:5432 play=> \pset null "(null)"
peter(at)localhost:5432 play=> \pset format latex
peter(at)localhost:5432 play=> select * from foo;
\begin{tabular}{|r|l|}
\hline
first & second \\
\hline
2 & (null) \\
0 & ----- \\
0 & hi \\
34 & (null) \\
-1 & -2 \\
(null) & yo &&& <> ho \\ % Yes, this needs to be escaped.
99999999 & this is text \\
\hline
\end{tabular}

(7 rows) \\
peter(at)localhost:5432 play=> \pset null
Current null display is "(null)".
peter(at)localhost:5432 play=> \pset fieldsep
Current field separator is ",,".

(Oh, you actually read all the way down to here? Good.)

--
Peter Eisentraut Sernanders vaeg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-10-19 21:32:36 Re: [HACKERS] Readline use in trouble?
Previous Message Mike Mascari 1999-10-19 19:18:35 Re: [HACKERS] Re: [BUGS] Postgres problems with 6.4 / 6.5 (fwd)