Re: varchar length... PHP

From: mike g <mike(at)thegodshalls(dot)com>
To: Constantin Khatsckevich <c(at)const(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: varchar length... PHP
Date: 2004-07-17 04:36:04
Message-ID: 1090038964.14010.42.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Varchar by default will truncate extra space at the end. If the table
column is defined as char or you cast the varchar to a char data type it
will have a fixed size of 40 characters.

Mike

On Tue, 2004-07-13 at 06:29, Constantin Khatsckevich wrote:
> Hello!
>
> Can I get ordered length of the varchar field? I need it in PHP script.
>
> For example,
> CREATE TABLE t1
> (
> id int,
> str varchar(40)
> );
>
> PHP function pg_FieldSize() returns me -1 for field str, because this is
> variable length field, but I need got 40 (in the my example). May be
> like sizeof() ?????
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mike g 2004-07-17 04:42:00 Re: server closed the connection unexpectedly
Previous Message mike g 2004-07-17 04:34:21 Re: Problem Report