From: khuddleston@pivotal.io
To: pgsql-bugs@postgresql.org
Subject: BUG #14706: Dependencies not recorded properly for base types
Date: Wed, 14 Jun 2017 23:22:59 +0000
Message-ID: <20170614232259.1424.82774@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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 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.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: khuddleston@pivotal.io
Subject: Re: BUG #14706: Dependencies not recorded properly for base types
In-Reply-To: <20170614232259.1424.82774@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox