From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: plans for PostgreSQL 12 |
Date: | 2018-06-04 07:24:42 |
Message-ID: | 58d491d2-6a68-4636-6cc2-2d5d6b30d555@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 04/06/18 09:12, Pavel Stehule wrote:
> 2018-06-04 8:35 GMT+02:00 Simon Riggs <simon(at)2ndquadrant(dot)com>:
>>
>> Sounds good. I think this would need to be restricted by operator and
>> datatype, since in general you won't know if the datatype functions
>> need a snapshot or not. Immutable functions for the operators ought to
>> do it, but I think that might not be enough.
>
> It requires introduction of new "safe" functions (& operators). Immutable
> functions are not enough safe.
>
> CREATE OR REPLACE FUNCTION public.fx()
> RETURNS integer
> LANGUAGE plpgsql
> IMMUTABLE
> AS $function$
> BEGIN
> RETURN (SELECT count(*) FROM pg_class);
> END;
> $function$
>
> postgres=# SELECT fx();
> ┌─────┐
> │ fx │
> ╞═════╡
> │ 343 │
> └─────┘
> (1 row)
That function is incorrectly marked as IMMUTABLE. In that situation,
it's enough that we throw a sane error like "ERROR: no snapshot available".
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2018-06-04 07:37:02 | Re: plans for PostgreSQL 12 |
Previous Message | Pavel Stehule | 2018-06-04 07:12:49 | Re: plans for PostgreSQL 12 |