BUG #14706: Dependencies not recorded properly for base types

From: khuddleston(at)pivotal(dot)io
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14706: Dependencies not recorded properly for base types
Date: 2017-06-14 23:22:59
Message-ID: 20170614232259.1424.82774@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14706
Logged by: Karen Huddleston
Email address: khuddleston(at)pivotal(dot)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 functions
Schema | Name | Result data type | Argument data types | Type
--------+--------------+------------------+---------------------+--------
public | base_fn_in | base_type | cstring | normal
public | 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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-06-15 00:42:16 Re: BUG #14706: Dependencies not recorded properly for base types
Previous Message Michael Paquier 2017-06-14 21:57:55 Re: Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog