X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A0945B43A66 for ; Thu, 3 Jul 2003 15:57:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 19435-09 for ; Thu, 3 Jul 2003 12:56:57 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 54B1EB43A0F for ; Thu, 3 Jul 2003 12:56:43 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by www.postgresql.com (Postfix) with SMTP id 41F19CF6634 for ; Thu, 3 Jul 2003 08:20:05 -0300 (ADT) Received: (qmail 19494 invoked by uid 500); 3 Jul 2003 11:22:52 -0000 Date: Thu, 3 Jul 2003 06:22:52 -0500 From: Bruno Wolff III To: yanping huang Cc: pgsql-php@postgresql.org Subject: Re: help Message-ID: <20030703112252.GB19441@wolff.to> Mail-Followup-To: yanping huang , pgsql-php@postgresql.org References: <20030702205111.8629ABF741@email.altimate.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030702205111.8629ABF741@email.altimate.ca> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/16 X-Sequence-Number: 2128 On Wed, Jul 02, 2003 at 16:51:11 -0400, yanping huang 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