Re: Determine a function's volatility in C - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Determine a function's volatility in C
Date
Msg-id CAFj8pRB+d0mqCSH06eHREtS0ELzqe866BBpiCFtwtY5xDqxCsA@mail.gmail.com
Whole thread Raw
In response to Determine a function's volatility in C  (Bborie Park <bkpark@ucdavis.edu>)
List pgsql-general
Hello

2011/11/12 Bborie Park <bkpark@ucdavis.edu>:
> Hey all,
>
> I'm wondering if there is a way to determine a function's volatility
> in C.  The function information provided through fmgr_info() doesn't
> provide it.  Ideas?
>

you should to look to pg_proc table

search in postgresql code

         tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
        if (!HeapTupleIsValid(tuple))
                elog(ERROR, "cache lookup failed for function %u", funcoid);
        proc = (Form_pg_proc) GETSTRUCT(tuple);

 ...


        switch (proc->provolatile)
        {
                case PROVOLATILE_IMMUTABLE:
                        appendStringInfoString(&buf, " IMMUTABLE");
                        break;
                case PROVOLATILE_STABLE:
                        appendStringInfoString(&buf, " STABLE");
                        break;
                case PROVOLATILE_VOLATILE:
                        break;
        }

...

        ReleaseSysCache(tuple);

Regards

Pavel Stehule


> Thanks,
> Bborie
>
> --
> Bborie Park
> Programmer
> Center for Vectorborne Diseases
> UC Davis
> 530-752-8380
> bkpark@ucdavis.edu
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

pgsql-general by date:

Previous
From: Bborie Park
Date:
Subject: Determine a function's volatility in C
Next
From: Tom Lane
Date:
Subject: Re: Determine a function's volatility in C