[BUGS] BUG #14706: Dependencies not recorded properly for base types - Mailing list pgsql-bugs

From khuddleston@pivotal.io
Subject [BUGS] BUG #14706: Dependencies not recorded properly for base types
Date
Msg-id 20170614232259.1424.82774@wrigleys.postgresql.org
Whole thread Raw
Responses Re: [BUGS] BUG #14706: Dependencies not recorded properly for base types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14706
Logged by:          Karen Huddleston
Email address:      khuddleston@pivotal.io
PostgreSQL version: 9.5.7
Operating system:   macOS Sierra
Description:

Repro
```CREATE FUNCTION base_fn_in(cstring) returns opaque as 'boolin' language
internal;
CREATE FUNCTION base_fn_out(opaque) returns opaque as 'boolout' language
internal;
CREATE TYPE base_type(input=base_fn_in, output=base_fn_out);

\df                           List of functionsSchema |     Name     | Result data type | Argument data types |  Type
--------+--------------+------------------+---------------------+--------public | base_fn_in  | base_type        |
cstring            | normalpublic | base_fn_out | cstring          | base_type           | normal
 

DROP TYPE base_type;

\df
ERROR:  cache lookup failed for type 22241 (format_type.c:137)
```

When I first create the functions, they are not dependent on other objects.
However, when I create base_type, the functions are modified to use the new
type. Then, dropping the type first causes the functions to have a cache
lookup error because they are missing a new dependency. It is possible to
clean up the state if you run DROP FUNCTION base_fn_out(base_type) CASCADE;
and then DROP FUNCTION base_fn_in(cstring);, but if you run DROP TYPE
base_type; first, it is impossible to drop base_fn_out. Base types should
make users run CASCADE to clean up dependencies in the other direction.
Additionally, the documentation claims that running DROP TYPE ... CASCADE
"Automatically drops objects that depend on the type (such as table columns,
functions, operators).", but it doesn't seem to do anything.


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [BUGS] Re: BUG #14680: startup process on standby encounter adeadlock of TwoPhaseStateLock when redo 2PC xlog
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14706: Dependencies not recorded properly for base types