pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: myon@debian.org
Subject: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension
Date: Mon, 12 Feb 2018 17:35:56 +0000
Message-ID: <151845695673.1447.1976587386911561582@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15061
Logged by:          Christoph Berg
Email address:      myon@debian.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



view thread (3+ messages)  latest in thread

Message-ID: <151845695673.1447.1976587386911561582@wrigleys.postgresql.org>
Permalink:  ../151845695673.1447.1976587386911561582@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/151845695673.1447.1976587386911561582@wrigleys.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, myon@debian.org
  Subject: Re: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension
  In-Reply-To: <151845695673.1447.1976587386911561582@wrigleys.postgresql.org>
  References: <151845695673.1447.1976587386911561582@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