dbTalk Databases Forums  

[BUGS] Domain Implicit Casting Trouble

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Domain Implicit Casting Trouble in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave Hartwig
 
Posts: n/a

Default [BUGS] Domain Implicit Casting Trouble - 10-06-2003 , 02:22 PM






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.=20=20

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 =3D '1'::text;

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

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

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

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

TIA
David

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Domain Implicit Casting Trouble - 10-06-2003 , 03:16 PM






"Dave Hartwig" <daveh (AT) Routescape (DOT) com> writes:
Quote:
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.
Fixed in CVS tip. Thanks for the report.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.