By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,781 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,781 IT Pros & Developers. It's quick & easy.

Spacing in output

P: n/a
I have a small training database: sql_tutorial. It works fine but the spacing
between the output lines is too much. This is the way it looks when I copy
and paste from the Konsole to this email:

sql_tutorial=> SELECT prod_name FROM Products;
prod_name
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear
This is the way it looks on the Konsole:

sql_tutorial=> SELECT prod_name FROM Products;

prod_name
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear

How can I change the Konsole output to look like the first example?
Thanks,
Jerome

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
The spacing in Konsole is directly related to the wrapping that it's
doing based on the size of the prod_name field (I.e., length in terms
of characters).

You can alter the format settings of psql. See:

http://www.postgresql.org/docs/7.4/static/app-psql.html

-tfo

On Sep 14, 2004, at 4:05 PM, Jerome Lyles wrote:
I have a small training database: sql_tutorial. It works fine but the
spacing
between the output lines is too much. This is the way it looks when I
copy
and paste from the Konsole to this email:

sql_tutorial=> SELECT prod_name FROM Products;
prod_name
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
--------------------------------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear
This is the way it looks on the Konsole:

sql_tutorial=> SELECT prod_name FROM Products;

prod_name
-----------------------------------------------------------------------
---------------
-----------------------------------------------------------------------
---------------
-----------------------------------------------------------------------
---------------
------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear

How can I change the Konsole output to look like the first example?
Thanks,
Jerome

---------------------------(end of
broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2

P: n/a
On Tue, Sep 14, 2004 at 11:05:46AM -1000, Jerome Lyles wrote:
I have a small training database: sql_tutorial. It works fine but the spacing
between the output lines is too much. This is the way it looks when I copy
and paste from the Konsole to this email:

sql_tutorial=> SELECT prod_name FROM Products;
Is prod_name a char(n) for some large n?

Cheers,
D prod_name
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear
This is the way it looks on the Konsole:

sql_tutorial=> SELECT prod_name FROM Products;

prod_name
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
------------------
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear

How can I change the Konsole output to look like the first example?
Thanks,
Jerome

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


--
David Fetter da***@fetter.org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #3

P: n/a
On Tuesday 14 September 2004 11:27 am, David Fetter wrote:
On Tue, Sep 14, 2004 at 11:05:46AM -1000, Jerome Lyles wrote:
I have a small training database: sql_tutorial. It works fine but the
spacing between the output lines is too much. This is the way it looks
when I copy and paste from the Konsole to this email:

sql_tutorial=> SELECT prod_name FROM Products;


Is prod_name a char(n) for some large n?

Cheers,
D

char(255)
Jerome

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4

P: n/a
On Tue, Sep 14, 2004 at 06:37:40PM -1000, Jerome Lyles wrote:
On Tuesday 14 September 2004 11:27 am, David Fetter wrote:
On Tue, Sep 14, 2004 at 11:05:46AM -1000, Jerome Lyles wrote:
I have a small training database: sql_tutorial. It works fine
but the spacing between the output lines is too much. This is
the way it looks when I copy and paste from the Konsole to this
email: sql_tutorial=> SELECT prod_name FROM Products;


Is prod_name a char(n) for some large n?

Cheers,
D

char(255)


Well, Don't Do That, Then. TEXT is a great type for storing text.
VARCHAR(n) is a TEXT with a maximum length constraint, and CHAR(n)
(fixed length) is pretty nearly obsolete.

Cheers,
D
--
David Fetter da***@fetter.org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #5

P: n/a
On Wednesday 15 September 2004 05:24 am, David Fetter wrote:
On Tue, Sep 14, 2004 at 06:37:40PM -1000, Jerome Lyles wrote:
On Tuesday 14 September 2004 11:27 am, David Fetter wrote:
On Tue, Sep 14, 2004 at 11:05:46AM -1000, Jerome Lyles wrote:
> I have a small training database: sql_tutorial. It works fine
> but the spacing between the output lines is too much. This is
> the way it looks when I copy and paste from the Konsole to this
> email:
>
> sql_tutorial=> SELECT prod_name FROM Products;

Is prod_name a char(n) for some large n?

Cheers,
D


char(255)


Well, Don't Do That, Then. TEXT is a great type for storing text.
VARCHAR(n) is a TEXT with a maximum length constraint, and CHAR(n)
(fixed length) is pretty nearly obsolete.

Cheers,
D

This is amazing. Im using a book called 'Teach Yourself SQL in 10 minutes'
with a 2004 copyright and this is the second example of obsolete TEXT type
used in the examples so far.
Jerome

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #6

P: n/a
su******@hawaii.rr.com (Jerome Lyles) wrote in
news:200409141105.46091.su******@hawaii.rr.com:
I have a small training database: sql_tutorial. It works fine but the spacing between the output lines is too much. This is the way it looks when I copy and paste from the Konsole to this email:

the simplest is
SELECT prod_name::text FROM products;

(will cast the char(255) column to text and in the process removes all
trailing spaces.)

or use trim function to remove trailing spaces.

--
Rolf

Nov 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.