BUG #6681: pg_extension.extconfig after alter sequence drop table

Поиск
Список
Период
Сортировка
От phb.emaj@free.fr
Тема BUG #6681: pg_extension.extconfig after alter sequence drop table
Дата
Msg-id E1SdFX6-0006GO-8a@wrigleys.postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6681
Logged by:          Philippe BEAUDOIN
Email address:      phb.emaj@free.fr
PostgreSQL version: 9.1.4
Operating system:   Linux
Description:=20=20=20=20=20=20=20=20

When a table has been registered as an extension configuration table, it's
oid is reported in the extconfig column of the pg_extension table. But once
the table is dropped from the extension, it is still referenced in
pg_extension.extconfig.
Here is a test case to easily reproduce this issue.
Just copy/paste and adjust initial parameters.

#!/bin/sh

export PGINST=3D/usr/local/pg913
export PGBIN=3D$PGINST/bin
export PGEXT=3D$PGINST/share/postgresql/extension

export PGHOST=3Dlocalhost
export PGPORT=3D5913
export PGUSER=3Dpostgres
export PGDATABASE=3Dphb

echo
"-----------------------------------------------------------------------"
echo " Issue: extconfig from pg_extension after alter sequence drop table"
echo
"-----------------------------------------------------------------------"
echo Connection parameters: $PGHOST - $PGPORT - $PGUSER - $PGDATABASE

# Build the extension control file
cat >$PGINST/share/postgresql/extension/phb.control <<EOF=20
default_version =3D '1.0.0'
schema =3D phb
EOF

# Create a test database
$PGBIN/psql template1 -ac "drop database phb;"
$PGBIN/psql template1 -ac "create database phb;"

# create the create extension script
cat >$PGEXT/phb--1.0.0.sql <<EOF=20
create table tbl1 (col1 int not null primary key, col2 int);
select pg_catalog.pg_extension_config_dump('tbl1','');
EOF
echo "--> Create the extension"
$PGBIN/psql -ac "create extension phb;"
$PGBIN/psql -ac "\dx+ phb"
$PGBIN/psql -ac "select oid from pg_class where relname =3D 'tbl1';"
$PGBIN/psql -ac "select * from pg_extension;"

echo "--> OK, tbl1 is correctly referenced as a configuration tables"
echo "--> Now remove tbl1 from the extension and look at the result"
$PGBIN/psql -ac "alter extension phb drop table phb.tbl1;"
$PGBIN/psql -ac "select * from pg_extension;"

echo "--> Surprisingly, extconfig references tbl1 !!!"
echo "--> However, tbl1 is really out of the extension."
$PGBIN/psql -ac "\dx+ phb"
echo "--> This is confirmed by a pg_dump output"
$PGBIN/pg_dump -Fp

echo "--> And the extension and the table can be dropped separately"
$PGBIN/psql -ac "drop extension phb;"
$PGBIN/psql -ac "\d phb.tbl1"
$PGBIN/psql -ac "drop table phb.tbl1;"

# cleanup the environment
$PGBIN/psql template1 -ac "drop database phb;"
rm $PGINST/share/postgresql/extension/phb*

В списке pgsql-bugs по дате отправления:

Предыдущее
От: phb.emaj@free.fr
Дата:
Сообщение: BUG #6682: pg_dump and sequence values of serial columns for extension configuration tables
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: BUG #6680: error para ingresar