pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Display format for column
2+ messages / 2 participants
[nested] [flat]

* Display format for column
@ 2004-05-07 09:08 Abdul Wahab Dahalan <wahab@mimos.my>
  2004-05-07 09:58 ` Re: Display format for column Karel Zak <zakkr@zf.jcu.cz>
  0 siblings, 1 reply; 2+ messages in thread

From: Abdul Wahab Dahalan @ 2004-05-07 09:08 UTC (permalink / raw)
  To: pgsql-sql

Hi there!

How do we format column size for displaying data in postgresql.
for example my data type for customername is varchar(100) and I want to 
display the first 25 chars.
How should I do that?

can I do something like:

psql > column customername format a25




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Display format for column
  2004-05-07 09:08 Display format for column Abdul Wahab Dahalan <wahab@mimos.my>
@ 2004-05-07 09:58 ` Karel Zak <zakkr@zf.jcu.cz>
  0 siblings, 0 replies; 2+ messages in thread

From: Karel Zak @ 2004-05-07 09:58 UTC (permalink / raw)
  To: Abdul Wahab Dahalan <wahab@mimos.my>; +Cc: pgsql-sql

On Fri, May 07, 2004 at 05:08:21PM +0800, Abdul Wahab Dahalan wrote:
> Hi there!
> 
> How do we format column size for displaying data in postgresql.
> for example my data type for customername is varchar(100) and I want to 
> display the first 25 chars.
> How should I do that?

 "display" a data is a client problem only, but you can select part of
 string:

    # select substring('qwertyuiopasdfg' from 0 for 8);
     substring 
    -----------
      qwertyu
      
 or for your case:
 
    select substring(customername from 0 for 25) FROM yourtab;

 http://www.postgresql.org/docs/7.4/static/functions-string.html

    Karel

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-05-07 09:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-07 09:08 Display format for column Abdul Wahab Dahalan <wahab@mimos.my>
2004-05-07 09:58 ` Karel Zak <zakkr@zf.jcu.cz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox