vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| On 7/12/07, Tom Lane <tgl@sss.pgh.pa.us> 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? regards, -- Sibte Abbas EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate |
| ||||
| "Sibte Abbas" <sibtay@gmail.com> writes: > 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? No, the problem is that map_sql_typecoll_to_xmlschema_types is unaware that it must ignore dropped columns :-(. I committed a fix a few minutes ago. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org |