7.4b4 domain usage and select question

From: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
To: PGGeneral <pgsql-general(at)postgresql(dot)org>
Subject: 7.4b4 domain usage and select question
Date: 2003-10-18 16:42:18
Message-ID: 20031018104218.49191343.Robert_Creager@LogicalChaos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I'm using 7.4b4 with domains, and am having a problem with selecting without
casting.

create domain test_domain as integer check( (value notnull) and (value >= 1) );
create table test_table( field_1 test_domain, field_2 integer );
insert into test_table values( 1, 1 );
insert into test_table values( '2', '2' );
select * from test_table where field_2 = '1';
select * from test_table where field_1 = '1'; -- fails

The last select fails with 'operator is not unique: test_domain = "unknown"'

The insert with quoted values works fine without casting.

The HINT indicates I need to cast, which works find with either '1'::integer or
'1'::test_domain. Is this the correct behavior? Do I have to cast every quoted
value? The values are quoted through the usage of DBD::Pg.

Thanks,
Rob

--
10:32:54 up 78 days, 2:58, 4 users, load average: 2.00, 2.00, 2.00

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jitender Kumar C 2003-10-18 16:51:03 Timestamp to date conversion...plz help me
Previous Message Jitender Kumar C 2003-10-18 16:41:52 Timestamp to date conversion...plz help me