| From: | naveen kumar <mnaveendba2(at)gmail(dot)com> | 
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> | 
| Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> | 
| Subject: | Re: ERROR: functions in index expression must be marked IMMUTABLE | 
| Date: | 2015-03-25 23:57:32 | 
| Message-ID: | CADye41JhNKuS6T8FWGJhcQ7xNbjTbDe8-Bjcf2T6_6ZF1Qp2Sw@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-admin | 
Thank You so much David..
got it, before creating index, I need to make it as known function.
Thanks & Regards,
M Naveen Kuamr,
PostgreSQL Database Administrator,
Mobile Number: +91 7755929449.
On Thu, Mar 26, 2015 at 4:39 AM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Wed, Mar 25, 2015 at 3:54 PM, naveen kumar <mnaveendba2(at)gmail(dot)com>
> wrote:
>
>> Hello Experts..
>>
>> postgres=# create index idx_calls_call_datetime on calls using btree
>> ((call_datetime::date));
>> ERROR:  functions in index expression must be marked IMMUTABLE
>>
>> bit confused with above error, can any one please help me on this, and if
>> possible let me explain when this error occurs and what it does. Thanks in
>> advance.
>>
>
> A function used in creating an index must solely rely upon its parameter
> inputs (or internal definition, of course) during evaluation.  It cannot
> rely upon any external configuration.  Casting to date (from unknown or
> timestamptz) requires knowledge of timezone, a system-level (i.e. external
> to the function) configuration and so cannot be part of an index expression.
>
> Typically with timestamptz you first need to convert them to timestamp
> using a known, usually UTC, timezone.  The conversion from timestamp (no
> tz) to date is immutable.  This can be done with "AT TIME ZONE":  SELECT
> now() AT TIME ZONE 'UTC';
>
> David J.
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Venkata Balaji N | 2015-03-26 03:00:11 | Re: Postgres 9 : - How to interpret the EXPLAIN query results | 
| Previous Message | David G. Johnston | 2015-03-25 23:09:59 | Re: ERROR: functions in index expression must be marked IMMUTABLE |