Re: help

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: yanping huang <yanping(at)altimate(dot)ca>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: help
Date: 2003-07-03 11:22:52
Message-ID: 20030703112252.GB19441@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Wed, Jul 02, 2003 at 16:51:11 -0400,
yanping huang <yanping(at)altimate(dot)ca> wrote:
> Hi,
> I am learning postgreSQL. Why I can't get a correct result using LPAD?

You are getting a correct result. If you review the documentation on LPAD
you will see that the length is the total length of the resulting string,
not the number of times to repeat the fill string.

>
> select LPAD('Hello',3); not -> ' Hello'
> lpad
> ------
> Hel
>
> select LPAD('ello',3,'H'); not -> 'HHHello'
> lpad
> ------
> ell
>
> select LPAD('hen', 1, '^');
> lpad
> ------
> h
>
>
> How can I put a '^' befor a variable of VARCHAR type in a function?
>
> Yanping
> --
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Browse pgsql-php by date

  From Date Subject
Next Message Michael Hanna 2003-07-03 15:19:14 query, display questions
Previous Message Dani Oderbolz 2003-07-02 10:49:09 Re: user authemtication with php/postgresql