-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
Description
This looks similar to #59, but with enums. The error occurs a little earlier, in load_all_relations.
To reproduce this problem you need an extension containing composite type containing an enum. I couldn't find anything like that in the standard postgresql distribution, so I put together a dummy extension. This short script will create the extension, or you can grab the archive linked below and unpack it in your postgresql share dir.
pgsharedir=$(pg_config --sharedir)
cat >$pgsharedir/extension/dummy.control <<'EOF'
# dummy extension
comment = 'dummy test extension'
default_version = '0.0.1'
relocatable = true
EOF
cat >$pgsharedir/extension/dummy--0.0.1.sql <<'EOF'
SET client_min_messages = warning;
CREATE TYPE color AS ENUM (
'blue',
'teal',
'aqua',
'grey',
'eggshell');
CREATE TYPE colorpair AS (
a color,
b color);
EOF
Once the extension is installed, the following schema should reproduce the problem.
create extension dummy;
create table foo (id serial primary key, xx colorpair);Traceback (most recent call last):
File ".../bin/migra", line 3, in <module>
import re
File ".../lib/python3.6/site-packages/migra/command.py", line 108, in do_command
status = run(args)
File ".../lib/python3.6/site-packages/migra/command.py", line 79, in run
m = Migration(ac0, ac1, schema=schema, exclude_schema=exclude_schema)
File ".../lib/python3.6/site-packages/migra/migra.py", line 26, in __init__
x_from, schema=schema, exclude_schema=exclude_schema
File ".../lib/python3.6/site-packages/schemainspect/get.py", line 20, in get_inspector
inspected = ic(c)
File ".../lib/python3.6/site-packages/schemainspect/pg/obj.py", line 1060, in __init__
super(PostgreSQL, self).__init__(c, include_internal)
File ".../lib/python3.6/site-packages/schemainspect/inspector.py", line 25, in __init__
self.load_all()
File ".../lib/python3.6/site-packages/schemainspect/pg/obj.py", line 1064, in load_all
self.load_all_relations()
File ".../lib/python3.6/site-packages/schemainspect/pg/obj.py", line 1319, in load_all_relations
for c in clist
File ".../lib/python3.6/site-packages/schemainspect/pg/obj.py", line 1320, in <listcomp>
if c.position_number
File ".../lib/python3.6/site-packages/schemainspect/pg/obj.py", line 1302, in get_enum
return self.enums[quoted_full_name]
KeyError: '"sterling"."rrule_freq"'
jaredramirez