X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 555FD52812 for ; Thu, 23 Jun 2005 05:41:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81936-08 for ; Thu, 23 Jun 2005 08:40:54 +0000 (GMT) Received: from kaartjeposten.nl (unknown [82.192.72.223]) by svr1.postgresql.org (Postfix) with ESMTP id 4B6DC5295A for ; Thu, 23 Jun 2005 05:40:53 -0300 (ADT) Received: from [172.16.77.10] (p508FCE44.dip.t-dialin.net [::ffff:80.143.206.68]) (AUTH: LOGIN anthony@kaartjeposten.nl) by kaartjeposten.nl with esmtp; Thu, 23 Jun 2005 10:40:54 +0200 id 0003FEDB.42BA7596.00004419 Received-SPF: unknown (Address does not pass the Sender Policy Framework) SPF=HELO; sender=[172.16.77.10]; remoteip=::ffff:80.143.206.68; remotehost=p508FCE44.dip.t-dialin.net; helo=[172.16.77.10]; receiver=kaartjeposten.nl; Received-SPF: none (Address does not pass the Sender Policy Framework) SPF=MAILFROM; sender=anthony@kaartjeposten.nl; remoteip=::ffff:80.143.206.68; remotehost=p508FCE44.dip.t-dialin.net; helo=[172.16.77.10]; receiver=kaartjeposten.nl; Message-ID: <42BA7593.2030803@kaartjeposten.nl> Date: Thu, 23 Jun 2005 10:40:51 +0200 From: Anthony van den Berg Reply-To: anthony@kaartjeposten.nl Organization: Kaartjeposten.nl User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Raul Secan Cc: pgsql-php@postgresql.org Subject: Re: varchar error References: <000d01c577cc$2c9c1f30$0a10a8c0@zerosoft.ro> In-Reply-To: <000d01c577cc$2c9c1f30$0a10a8c0@zerosoft.ro> Content-Type: multipart/alternative; boundary="------------010607010608060009040805" Received-SPF: none (Address does not pass the Sender Policy Framework) SPF=FROM; sender=anthony@kaartjeposten.nl; remoteip=::ffff:80.143.206.68; remotehost=p508FCE44.dip.t-dialin.net; helo=[172.16.77.10]; receiver=kaartjeposten.nl; X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.096 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200506/21 X-Sequence-Number: 3180 This is a multi-part message in MIME format. --------------010607010608060009040805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit you might try a trigger! Raul Secan wrote: > Hello, I just have this: > > CREATE TABLE test ( > mytext varchar(5) > ) WITHOUT OIDS; > > If I put a string with more than 5 chars in mytext, I receive an > error, regarding the wrong lenght of the string. > > In MySQL I know that the string is automatically reduced to the number > of char allowed by the column, even if I insert a longer string. > > I don't want to do this from PHP, and I was wandering how this can be > done in PostreSQL? Maybe in CREATE TABLE definition? > > Cheers, Raul. -- Kaartjeposten.nl Molukkenstraat 80 / 7512 XT Enschede * info@kaartjeposten.nl / msn. kaartjeposten@hotmail.com i. www.kaartjeposten.nl / t. 06 - 28 13 88 57 Nu ook voor uw verjaardagkalenders --------------010607010608060009040805 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit you might try a trigger!


Raul Secan wrote:
Hello, I just have this:
 
CREATE TABLE test (
    mytext varchar(5)
) WITHOUT OIDS;
 
If I put a string with more than 5 chars in mytext, I receive an error, regarding the wrong lenght of the string.
 
In MySQL I know that the string is automatically reduced to the number of char allowed by the column, even if I insert a longer string.
 
I don't want to do this from PHP, and I was wandering how this can be done in PostreSQL? Maybe in CREATE TABLE definition?
 
Cheers, Raul.

--
kaartjeposten

Kaartjeposten.nl
Molukkenstraat 80 / 7512 XT  Enschede
* info@kaartjeposten.nl / msn. kaartjeposten@hotmail.com
i. www.kaartjeposten.nl / t. 06 - 28 13 88 57
Nu ook voor uw verjaardagkalenders


--------------010607010608060009040805--