Re: Is temporary functions feature official/supported? Found some issues with it.

From: Alexey Bashtanov <bashtanov(at)imap(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, alvherre(at)2ndquadrant(dot)com, dimitri(at)citusdata(dot)com
Subject: Re: Is temporary functions feature official/supported? Found some issues with it.
Date: 2019-01-04 13:13:15
Message-ID: be61994e-cb5b-ae80-131b-3ae273a2f737@imap.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-01-04 13:13:51 Re: Is temporary functions feature official/supported? Found some issues with it.
Previous Message Michael Paquier 2019-01-04 13:00:48 Re: BUG #15548: Unaccent does not remove combining diacritical characters