From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
Cc: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: 2 questions about volatile attribute of pg_proc. |
Date: | 2021-04-20 02:57:00 |
Message-ID: | CAFj8pRCS5y0yWTqG2ZM+naMhXrNKGG7sHucALU25PXpjPEmyZg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
út 20. 4. 2021 v 4:47 odesílatel Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> napsal:
>
>
> > - a PL/PGSQL function's meaning depends on the search path in effect
> when it is called, unless it has a SET search_path clause or it fully
> qualifies all object references, so it isn't actually possible in general
> to determine what a function calls at definition time
>
>
> I'd think this one as a blocker issue at the beginning since I have to
> insist on
> any new features should not cause semantic changes for existing ones.
> Later I
> found the new definition. As for this feature request, I think we can
> define the
> features like this:
>
> 1. We define a new attribute named VOLATILE_AUTO; The semantic is PG will
> auto
> detect the volatile info based on current search_path / existing
> function. If any embedded function can't be found, we can raise an
> error if
> VOLATILE_AUTO is used. If people change the volatile attribute later,
> we can:
> a). do nothing. This can be the documented feature. or. b). Maintain the
> dependency tree between functions and if anyone is changed, other
> functions
> should be recalculated as well.
>
> 2. VOLATILE_AUTO should never be the default value. It only works when
> people
> requires it.
>
> Then what we can get from this? Thinking a user is migrating lots of UDF
> from
> other databases. Asking them to check/set each function's attribute might
> be bad. However if we tell them about how VOLATILE_AUTO works, and they
> accept it (I guess most people would accept), then the migration would be
> pretty productive.
>
> I'm listening to any obvious reason to reject it.
>
a) This analyses can be very slow - PLpgSQL does lazy planning - query
plans are planned only when are required - and this feature requires
complete planning current function and all nested VOLATILE_AUTO functions -
so start of function can be significantly slower
b) When you migrate from Oracle,then you can use the STABLE flag, and it
will be mostly correct.
Regards
Pavel
> --
> Best Regards
> Andy Fan (https://www.aliyun.com/)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2021-04-20 02:58:37 | Re: amcheck eating most of the runtime with wal_consistency_checking |
Previous Message | Andy Fan | 2021-04-20 02:55:53 | Re: 2 questions about volatile attribute of pg_proc. |