From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | myon(at)debian(dot)org |
Subject: | BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension |
Date: | 2018-02-12 17:35:56 |
Message-ID: | 151845695673.1447.1976587386911561582@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: 15061
Logged by: Christoph Berg
Email address: myon(at)debian(dot)org
PostgreSQL version: 10.2
Operating system: Debian
Description:
For upgrading the data tables in my "unit" extension, I want to create
temporary tables to hold data before it is merged into the real tables.
Unfortunately it doesn't let me create the TEMP tables as ON COMMIT DROP:
$ cat tmptblbug.control
default_version = '1'
$ cat tmptblbug--1.sql
create temp table foo (id int) on commit drop;
$ cat Makefile
EXTENSION = tmptblbug
DATA = tmptblbug--1.sql
PG_CONFIG = pg_config
PGXS = $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
postgres=# create extension tmptblbug;
ERROR: cannot drop table foo because extension tmptblbug requires it
TIP: You can drop extension tmptblbug instead.
Real-world use case:
https://github.com/ChristophBerg/postgresql-unit/blob/master/unit--6.sql.in#L60-L83
Seen on 10.2 and git HEAD.
Workarounds:
1) Explicitly drop the table within the .control file
2) Don't use ON COMMIT DROP (but that leaks the temp tables to the invoking
session)
(Docs mention the possibility to create temp objects within the .control
file, so it's definitely meant to be supported.)
Thanks,
Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2018-02-12 17:55:37 | Re: Fwd: postgresql performance question |
Previous Message | David G. Johnston | 2018-02-12 15:29:04 | Re: BUG #15057: Issue with UNKNOW type when calling a PostgreSQL function from java code |