Re: [HACKERS] conversion problems with domains

2003-03-22 Thread Tom Lane
Andreas Pflug [EMAIL PROTECTED] writes:
 PostgreSQL 7.3.2
 CREATE DOMAIN testdom AS int4;
 CREATE TABLE testtab(testcol testdom);
 INSERT INTO testtab VALUES (1);
 INSERT INTO testtab VALUES (2);
 VACUUM ANALYZE testtab;

 SELECT * FROM testtab WHERE testcol  1;

I've applied a patch to fix this.

regards, tom lane


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


[HACKERS] conversion problems with domains

2003-03-21 Thread Andreas Pflug
PostgreSQL 7.3.2

CREATE DOMAIN testdom AS int4;
CREATE TABLE testtab(testcol testdom);
INSERT INTO testtab VALUES (1);
INSERT INTO testtab VALUES (2);
VACUUM ANALYZE testtab;
SELECT * FROM testtab WHERE testcol  1;

The select will give
   ERROR: convert_numeric_to_scalar: unsupported type 3381436
If no VACUUM ANALYZE is performed (no entry in pg_stats), the select 
will work ok.
The select will also succeed, if testcol is compared to something 
different from 1.

Defining a cast
   CREATE CAST(testdom as int4) WITHOUT FUNCTION AS IMPLICIT
doesn't help.
If I change the datatype

   UPDATE pg_attribute
 SET atttypid=(select oid from pg_type where typname = 'int4')
 WHERE atttypid=(select oid from pg_type where typname = 'testdom')
   AND attname='testcol'
the select will work as expected.





---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]