Domain Implicit Casting Trouble

From: "Dave Hartwig" <daveh(at)Routescape(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Domain Implicit Casting Trouble
Date: 2003-10-06 19:19:18
Message-ID: 26751392596DDD4D84FE1806D1F819B7B55DB6@exchange.insight
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I came across the following problem when migrating from 7.3.4 to 7.4b4.
Query #4 does not fail under version 7.3.4. But it does under version
7.4b4. It seems that in some situations the implicit cast fails. It
would not be a problem if I had the opportunity to manually cast these
queries. But I don't. I am using a client package (Hibernate) which
generates statements automatically based on an O/R mapping.

CREATE DOMAIN foo_varchardomain AS varchar(10);

CREATE DOMAIN foo_intdomain AS int4;

CREATE TABLE foo_table (i foo_intdomain, c foo_varchardomain);

INSERT INTO foo_table VALUES (1, 'x');

SELECT * FROM foo_table WHERE i = '1'::text;

SELECT * FROM foo_table WHERE i::int4 = '1'; -- query #1 ok

SELECT * FROM foo_table WHERE i = 1; -- query #2 ok

SELECT * FROM foo_table WHERE c = 'x'; -- query #3 ok

SELECT * FROM foo_table WHERE i = '1'; -- query #4 ERROR
ERROR: operator is not unique: foo_intdomain = "unknown"
HINT: Could not choose a best candidate operator. You may need to add
explicit type casts.

TIA
David

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-10-06 20:10:27 Re: Domain Implicit Casting Trouble
Previous Message Tom Lane 2003-10-06 14:26:33 Re: 7.4beta4: make check broken?