From: Alexey Bashtanov <bashtanov@imap.cc>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Cc: alvherre@2ndquadrant.com
Cc: dimitri@citusdata.com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
Date: Fri, 4 Jan 2019 13:13:15 +0000
Message-ID: <be61994e-cb5b-ae80-131b-3ae273a2f737@imap.cc> (raw)
In-Reply-To: <10857.1546467488@sss.pgh.pa.us>
References: <5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.cc>
<22938.1546456949@sss.pgh.pa.us>
<52794060-3339-e699-a8d5-e3dd7c81fa95@imap.cc>
<10857.1546467488@sss.pgh.pa.us>
> Hm. I can reproduce this if I start in a virgin database, but not
> otherwise.
for a database with a history of temporary namespaces we just need more
parallel prepared transactions
> There's no reason this would be special to functions.
temp functions are allowed in prepared transactions, unlike tables/views
-- that's the reason I thought about functions
Unfortunately I failed to reproduce a crash or a data corruption.
The most interesting I could see was the following:
--------example 1-------
-- session 1:
begin;
create function pg_temp.foo() returns void as $$begin end;$$ language
plpgsql;
prepare transaction 'z';
create function pg_temp.foo() returns void as $$begin end;$$ language
plpgsql;
-- session 2:
commit prepared 'z';
-- session 1 prints:
-- ERROR: duplicate key value violates unique constraint
"pg_proc_proname_args_nsp_index"
-- DETAIL: Key (proname, proargtypes, pronamespace)=(foo, , 16385)
already exists.
--------example 2-------
-- session 1:
begin;
create function pg_temp.foo() returns void as $$begin end;$$ language
plpgsql;
-- session 2:
begin;
create function pg_temp.foo() returns void as $$begin end;$$ language
plpgsql;
-- session 1:
prepare transaction 'z';
\q
-- session 2:
prepare transaction 'y';
\q
-- session 3:
begin;
create temp table t();
-- session 4:
commit prepared 'z';
commit prepared 'y';
-- session 3 prints:
-- ERROR: duplicate key value violates unique constraint
"pg_namespace_nspname_index"
-- LINE 1: create temp table t();
-- ^
-- DETAIL: Key (nspname)=(pg_temp_3) already exists.
Best,
Alex
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: bashtanov@imap.cc, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, dimitri@citusdata.com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
In-Reply-To: <be61994e-cb5b-ae80-131b-3ae273a2f737@imap.cc>
References: <5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.cc> <22938.1546456949@sss.pgh.pa.us> <52794060-3339-e699-a8d5-e3dd7c81fa95@imap.cc> <10857.1546467488@sss.pgh.pa.us> <be61994e-cb5b-ae80-131b-3ae273a2f737@imap.cc>
* 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