pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: yanping huang <yanping@altimate.ca>
Cc: pgsql-php@postgresql.org
Subject: Re: help
Date: Thu, 3 Jul 2003 06:22:52 -0500
Message-ID: <20030703112252.GB19441@wolff.to> (raw)
In-Reply-To: <20030702205111.8629ABF741@email.altimate.ca>
References: <20030702205111.8629ABF741@email.altimate.ca>

On Wed, Jul 02, 2003 at 16:51:11 -0400,
  yanping huang <yanping@altimate.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



view thread (16+ messages)  latest in thread

Message-ID: <20030703112252.GB19441@wolff.to>
Permalink:  ../20030703112252.GB19441@wolff.to/
Also on:    postgresql.org/message-id/20030703112252.GB19441@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: bruno@wolff.to, yanping@altimate.ca
  Subject: Re: help
  In-Reply-To: <20030703112252.GB19441@wolff.to>
  References: <20030702205111.8629ABF741@email.altimate.ca> <20030703112252.GB19441@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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