BUG #3659: should use implizit type cast in check constraint

From: "Michael Enke" <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3659: should use implizit type cast in check constraint
Date: 2007-10-08 15:04:36
Message-ID: 200710081504.l98F4aSP059656@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3659
Logged by: Michael Enke
Email address: michael(dot)enke(at)wincor-nixdorf(dot)com
PostgreSQL version: 8.1.4
Operating system: Linux, CentOS5
Description: should use implizit type cast in check constraint
Details:

Hello,
if I have defined my own data type/operators,
in a check constraint this type is used
instead of ::text.
Shouln't be there an implizit typecast to ::text?
Otherwise I always have to add an explicit typecast
if I have conflicting types/operators
but this would not be nice.

create table b(a varchar(1) check(a in ('1','2')));
\d b:
Table "public.b"
Column | Type | Modifiers
--------+----------------------+-----------
a | character varying(1) |
Check constraints:
"b_a_check" CHECK (a = '1'::text OR a = '2'::text)

But if I have defined a type testchar and create this table again without an
explicit type cast:
\d b
Table "public.b"
Column | Type | Modifiers
--------+----------------------+-----------
a | character varying(1) |
Check constraints:
"b_a_check" CHECK (a = '1'::testchar OR a = '2'::testchar)

I can send test case files if required.

Regards,
Michael

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2007-10-08 15:55:33 Re: BUG #3657: Performance leaks when using between of two equal dates
Previous Message Alessandra Bilardi 2007-10-08 09:44:27 BUG #3658: I've got disk-full errors when insert relational tables.