Re: Formatting Function..

From: "Andrew Bartley" <abartley(at)evolvosystems(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Formatting Function..
Date: 2004-07-05 07:05:26
Message-ID: CAEAIPJHMAFOJGDANDACKEHBEOAA.abartley@evolvosystems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Vinay

Using cast will pad the output with blanks.

Do you want to dynamically change the length of the name column?

Thanks

Andrew

-----Original Message-----
From: Vinay Jain [mailto:vinayjain(at)gmail(dot)com]
Sent: Monday, 5 July 2004 4:53 PM
To: abartley(at)evolvosystems(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Formatting Function..

Hi...
Thanks for response
I don't want casting... ...is this the only solution..

Regards
Vinay

On Mon, 5 Jul 2004 16:17:53 +1000, Andrew Bartley
<abartley(at)evolvosystems(dot)com> wrote:
> To format the column names you could try
>
> select cast(name as char(desired length)) as "Name", age as "Age" from
> student;
>
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of mike g
> Sent: Monday, 5 July 2004 3:44 PM
> To: Vinay Jain
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Formatting Function..
>
> Perhaps,
>
> select cast(name as varchar(desired length)) as name, age from student;
>
> Mike
> On Mon, 2004-07-05 at 00:19, Vinay Jain wrote:
> > Hi..
> > I am newbe in postgresql so please help me though the question may be
> > very easy to answer..
> > Is there any formatting function to get output with fix lengths..for
> > example my query is..
> > schema is:
> >
> > Student
> > (name Varchar,
> > age integer);
> >
> > select name, age from student;
> > the output is like this..
> > Name | Age
> > xyz | 22
> >
> > I want this length of name to be of my choice...is it possible..& how..
> >
> > thanks in advance
> > Regards
> > Vinay
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Vinay Jain
Dissertation Project Trainee
DAKE Division
C-DAC Mumbai

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Teodor Sigaev 2004-07-05 08:01:56 Re: Full Text Index Info
Previous Message Vinay Jain 2004-07-05 06:52:36 Re: Formatting Function..