Lists: pgsql-bugs
From: Ana Claudia <ana-b-dias(at)ptinovacao(dot)pt>
To: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject:
Date: 2001-09-24 09:28:31
Message-ID: 25CCC6566D01D411885B00A024559FB7011FE03F@EXCHANGE_GERAL
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello,

Usually, I use Oracle for develop database application. However, I
change my computer to Linux system (Mandrake 8) and I decide change database
to Postgresql.
In Oracle when I create a table where a colum is a char(n) or varchar(n), if
I try to insert in this table value bigger than n , I get an error. That
doesn't happen in Postgresql, if I try to insert a value bigger than n, it's
accept because trunk the value. I don't want that, if the value is bigger I
want an error. I created a check constraint with the function [char_length
(parameter) < (n+1)] but still not working. Can you help me to resolve this
problem? The version of Postgresql that I have is 7.1.2.

Best Regards,
Cláudia

Portugal


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ana Claudia <ana-b-dias(at)ptinovacao(dot)pt>
Cc: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re:
Date: 2001-09-27 17:17:12
Message-ID: 200109271717.f8RHHC820550@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


This will be fixed in the 7.2 release.

> Hello,
>
> Usually, I use Oracle for develop database application. However, I
> change my computer to Linux system (Mandrake 8) and I decide change database
> to Postgresql.
> In Oracle when I create a table where a colum is a char(n) or varchar(n), if
> I try to insert in this table value bigger than n , I get an error. That
> doesn't happen in Postgresql, if I try to insert a value bigger than n, it's
> accept because trunk the value. I don't want that, if the value is bigger I
> want an error. I created a check constraint with the function [char_length
> (parameter) < (n+1)] but still not working. Can you help me to resolve this
> problem? The version of Postgresql that I have is 7.1.2.
>
> Best Regards,
> Cl?udia
>
> Portugal
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Ana Claudia <ana-b-dias(at)ptinovacao(dot)pt>
Cc: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re:
Date: 2001-09-27 17:55:30
Message-ID: Pine.BSF.4.21.0109271054560.21569-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, 24 Sep 2001, Ana Claudia wrote:

> Hello,
>
> Usually, I use Oracle for develop database application. However, I
> change my computer to Linux system (Mandrake 8) and I decide change database
> to Postgresql.
> In Oracle when I create a table where a colum is a char(n) or varchar(n), if
> I try to insert in this table value bigger than n , I get an error. That
> doesn't happen in Postgresql, if I try to insert a value bigger than n, it's
> accept because trunk the value. I don't want that, if the value is bigger I
> want an error. I created a check constraint with the function [char_length
> (parameter) < (n+1)] but still not working. Can you help me to resolve this
> problem? The version of Postgresql that I have is 7.1.2.

I believe this will be fixed in the upcoming 7.2 release. The reason the
constraint doesn't work is probably that the truncation happens before the
check.