Re: pg_dump failed sanity check and user defined types - Mailing list pgsql-hackers

From Brook Milligan
Subject Re: pg_dump failed sanity check and user defined types
Date
Msg-id 200009111716.LAA10681@biology.nmsu.edu
Whole thread Raw
In response to Re: pg_dump failed sanity check and user defined types  (Brook Milligan <brook@biology.nmsu.edu>)
Responses Re: pg_dump failed sanity check and user defined types
List pgsql-hackers
>      pg_dump -sc -D test > pg_dump.schema || true     >      failed sanity check, type with oid 3516132 was not
found

The problem seems to be related to trying to install conversion
functions from one user defined type to another.  Scripts like the
following are fine:
    DROP TYPE xxx;
    DROP FUNCTION xxx_in (opaque);    CREATE FUNCTION xxx_in (opaque) RETURNS xxx AS '_OBJWD_/xxx.so', 'xxx_in'
LANGUAGE'c';
 
    DROP FUNCTION xxx_out(opaque);    CREATE FUNCTION xxx_out(opaque) RETURNS opaque AS '_OBJWD_/xxx.so', 'xxx_out'
LANGUAGE'c';
 
    CREATE TYPE xxx (internallength = 8, input = xxx_in, output = xxx_out);
    DROP TYPE yyy;
    DROP FUNCTION yyy_in (opaque);    CREATE FUNCTION yyy_in (opaque) RETURNS yyy AS '_OBJWD_/xxx.so', 'yyy_in'
LANGUAGE'c';
 
    DROP FUNCTION yyy_out(opaque);    CREATE FUNCTION yyy_out(opaque) RETURNS opaque AS '_OBJWD_/xxx.so', 'yyy_out'
LANGUAGE'c';
 
    CREATE TYPE yyy (internallength = 8, input = yyy_in, output = yyy_out);

But as soon as I add a conversion like the following to the end (I
presume conversion functions must follow the type definitions), I get
failed sanity checks.
    DROP FUNCTION xxx (yyy);    CREATE FUNCTION xxx (yyy) RETURNS xxx AS '_OBJWD_/xxx.so', 'xxx_int' LANGUAGE 'c';

I presume that notices like the following
    NOTICE:  ProcedureCreate: type 'xxx' is not yet defined

are fine, because you must create the I/O functions before the type.

So, how is one really supposed to create user defined types with
conversion functions without tripping on failed sanity checks?
Where else in the system catalogs can I look to find references to
the missing OIDs?

Thanks again for your help.

Cheers,
Brook


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Constant propagation and similar issues
Next
From: Brook Milligan
Date:
Subject: operators and indexes