Re: vacuum analyze fails: ERROR: Unable to locate type oid 2230924 in catalog - Mailing list pgsql-hackers

From Tom Lane
Subject Re: vacuum analyze fails: ERROR: Unable to locate type oid 2230924 in catalog
Date
Msg-id 27916.983246373@sss.pgh.pa.us
Whole thread Raw
In response to vacuum analyze fails: ERROR: Unable to locate type oid 2230924 in catalog  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: vacuum analyze fails: ERROR: Unable to locate type oid 2230924 in catalog  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> *** parse_coerce.c.orig    Sat Feb  3 20:07:53 2001
> --- parse_coerce.c    Tue Feb 27 11:33:01 2001
> ***************
> *** 190,195 ****
> --- 190,201 ----
>           Oid            inputTypeId = input_typeids[i];
>           Oid            targetTypeId = func_typeids[i]; 
> +         if (typeidIsValid(inputTypeId) == false)
> +             return(false);
> + 
> +         if (typeidIsValid(targetTypeId) == false)
> +             return(false);
> + 
>           /* no problem if same type */
>           if (inputTypeId == targetTypeId)
>               continue;

I'd suggest not arbitrarily erroring out when there is no need for
a conversion, and not doing the cache lookup implied by typeidIsValid
when it's not necessary to touch the type at all.  Hence, I'd recommend
moving this down a few lines.  Also, conform to the surrounding coding
style and add a comment:
    /* don't know what to do for the input type? then quit... */    if (inputTypeId == InvalidOid)        return
false;

+        /* don't choke on references to no-longer-existing types */
+         if (!typeidIsValid(inputTypeId))
+             return false;
+ 
+         if (!typeidIsValid(targetTypeId))
+             return false;
    /*     * If input is an untyped string constant, assume we can convert     * it to anything except a class type.
*/
 


BTW, is this sufficient to prevent the VACUUM failure, or are there more
problems downstream?
        regards, tom lane


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: Re[2]: Re: [PATCHES] A patch for xlog.c
Next
From: Bruce Momjian
Date:
Subject: Re: Re[2]: Re: [PATCHES] A patch for xlog.c