Thread: cache lookup failed for type 0

cache lookup failed for type 0

From
Gaetano Mendola
Date:
Hi all,
doing some tests:


regression=# create table test (a integer);
CREATE TABLE
regression=# alter table test add column b test;
ALTER TABLE
regression=# select * from test; a | b
---+---
(0 rows)

regression=# insert into test values ( 1, (2,null));   <--(1)
INSERT 4260928 1

regression=# \d test     Table "public.test" Column |  Type   | Modifiers
--------+---------+----------- a      | integer | b      | test    |

regression=# alter table test drop column a;
ALTER TABLE
regression=# insert into test values ( (3,null));
ERROR:  cache lookup failed for type 0

regression=# select * from test; b
---- ()
(1 row)

regression=# alter table test add column c integer;
ALTER TABLE
kalman=# select * from test;  b  | c
-----+--- (,) |
(1 row)

regression=# insert into test values ( (null,3), 4);  <--(2)
ERROR:  cannot cast type record to test
DETAIL:  Input has wrong number of columns.

regression=# \d test     Table "public.test" Column |  Type   | Modifiers
--------+---------+----------- b      | test    | c      | integer |



The two insert in (1) and (2) are the same ( change only the column order ),
but the (1) works and the (2) not.



Regards
Gaetano Mendola