On 7/12/07, Tom Lane <[EMAIL PROTECTED]> wrote:
In the regression database:

regression=# select schema_to_xmlschema('public',false,false,'foo');
ERROR:  cache lookup failed for type 0

I have no idea what this function should produce, but surely not that?

                        regards, tom lane

The following test case reproduces the problem:

create domain domtxt as text;
create table dom_tab(col1 domtxt);
drop domain domtxt cascade;
select schema_to_xmlschema('public',false,false,'foo');

Since domtxt domain is being dropped dom_tab should not contain any columns now.

However It appears that the tuple descriptor which
map_sql_typecoll_to_xmlschema_types() (in xml.c) gets for dom_tab
still shows one column (tupdesc->natts = 1). Subsequently when
SPI_gettypeid() is invoked it returns 0, which gets inserted in the
uniquetypes list.

Since the following foreach statement simply traverses the uniquetypes
list and invokes getBaseType() on its oid values, therefore 0 gets
passed to getBaseType()  which results in the "cache lookup failed
..." error.

Considering the above fact, perhaps the actual problem is that when a
column gets removed from a table as a result of drop  <column
type/domain> cascade, the tuple descriptor (more specifically
rel->rd_att field) for that relation is not updated properly?

Sibte Abbas
EnterpriseDB http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at


Reply via email to