BUG #3659: should use implizit type cast in check constraint - Mailing list pgsql-bugs

From Michael Enke
Subject BUG #3659: should use implizit type cast in check constraint
Date
Msg-id 200710081504.l98F4aSP059656@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #3659: should use implizit type cast in check constraint
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3659
Logged by:          Michael Enke
Email address:      michael.enke@wincor-nixdorf.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

pgsql-bugs by date:

Previous
From: "Alessandra Bilardi"
Date:
Subject: BUG #3658: I've got disk-full errors when insert relational tables.
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #3657: Performance leaks when using between of two equal dates