pltcl - "Cache lookup for attribute" error - version 2 - Mailing list pgsql-patches
From | Patrick Samson |
---|---|
Subject | pltcl - "Cache lookup for attribute" error - version 2 |
Date | |
Msg-id | 20040123091330.92487.qmail@web60304.mail.yahoo.com Whole thread Raw |
Responses |
Re: pltcl - "Cache lookup for attribute" error - version 2
|
List | pgsql-patches |
After a deeper analysis, this post supersedes my previous one with the same subject. I got the error message: ERROR: pltcl: Cache lookup for attribute '........pg.droppped.7........' type 0 failed when a pltcl trigger handler is fired. Attribute names beginning with a dot are filtered just in one place, in pltcl_trigger_handler(). (version 7.3.5) Attached is a patch to : - Add a filter in two other places, in relation with the mentioned error message: pltcl_set_tuple_values() pltcl_build_tuple_argument() - Add the same filter in the build of TG_relatts. This will prevent a tcl script which loops on TG_relattrs to fail in trying to use a dropped column. Note 1: the filter method is changed from testing if attname begins with a dot to testing the setting of attisdropped. I presume (to be confirmed or contradicted by a more authoritative developer than me) that the original dot filtering intent was to filter dropped columns. In other words, there is no case where a column name begins with '.' except dropped columns. If this is right, testing attisdropped is an adequate and more readable replacement. Note 2: with the addition of the filter in pltcl_build_tuple_argument(), filtering in pltcl_trigger_handler() is no more needed, so I put these lines in comments (may be removed in a final release). __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/--- pltcl.orig 2003-10-30 03:00:44.000000000 +0100 +++ pltclDotFilter2.c 2004-01-23 09:28:33.359375000 +0100 @@ -678,8 +678,9 @@ /* A list of attribute names for argument TG_relatts */ Tcl_DStringAppendElement(&tcl_trigtup, ""); for (i = 0; i < tupdesc->natts; i++) - Tcl_DStringAppendElement(&tcl_trigtup, - NameStr(tupdesc->attrs[i]->attname)); + if (!tupdesc->attrs[i]->attisdropped) + Tcl_DStringAppendElement(&tcl_trigtup, + NameStr(tupdesc->attrs[i]->attname)); Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup)); Tcl_DStringFree(&tcl_trigtup); Tcl_DStringInit(&tcl_trigtup); @@ -863,11 +864,11 @@ /************************************************************ * Ignore pseudo elements with a dot name ************************************************************/ - if (*(ret_values[i]) == '.') - { - i += 2; - continue; - } + //if (*(ret_values[i]) == '.') + //{ + // i += 2; + // continue; + //} /************************************************************ * Get the attribute number @@ -2352,6 +2353,12 @@ for (i = 0; i < tupdesc->natts; i++) { /************************************************************ + * Ignore dropped columns (attname begins with a dot, + * such as "........pg.dropped.7........") + ************************************************************/ + if (tupdesc->attrs[i]->attisdropped) continue; + + /************************************************************ * Get the attribute name ************************************************************/ attname = NameStr(tupdesc->attrs[i]->attname); @@ -2424,6 +2431,12 @@ for (i = 0; i < tupdesc->natts; i++) { /************************************************************ + * Ignore dropped columns (attname begins with a dot, + * such as "........pg.dropped.7........") + ************************************************************/ + if (tupdesc->attrs[i]->attisdropped) continue; + + /************************************************************ * Get the attribute name ************************************************************/ attname = NameStr(tupdesc->attrs[i]->attname);
pgsql-patches by date: