Re: 8.2.4 Won't Build 8.1 Functional Indexes

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: 8.2.4 Won't Build 8.1 Functional Indexes
Дата
Msg-id 20070606195459.GH11800@alvh.no-ip.org
обсуждение исходный текст
Ответ на 8.2.4 Won't Build 8.1 Functional Indexes  ("Chris Hoover" <revoohc@gmail.com>)
Ответы Re: 8.2.4 Won't Build 8.1 Functional Indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Chris Hoover escribió:
> I am testing upgrades to 8.2.4 from 8.1.3 and am having problems with
> 8.2.4balking at the functional indexes I have created.  These indexes
> exist and
> work fine in 8.1.3, so why is 8.2.4 rejecting them?
>
> Index 1:
> CREATE INDEX acceptedbilling_to_date_accepted_billing_dt_idx
>  ON acceptedbilling
>  USING btree
>  (to_date(accepted_billing_dt::text, 'yyyymmdd'::text));.
>
> Reject:
> ERROR: functions in index expression must be marked IMMUTABLE
> SQL state: 42P17

You can't do this because to_date and other functions are not immutable.
8.2 seems to be more picky about this -- the date conversions of
timestamptz columns are dependent on the current timezone.  Perhaps you
could change this to avoid this kind of conversions, doing things like

create index foo on bar
(to_date(accepted_billing_dt at time zone 'GMT'), 'yyymmdd')

I am not sure if this actually works -- but you would need to change the
queries as well.  The point is that the time zone is now fixed, instead
of being dependent on a GUC variable.

--
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
"I think my standards have lowered enough that now I think 'good design'
is when the page doesn't irritate the living f*ck out of me." (JWZ)

В списке pgsql-admin по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: the right time to vacuum database?
Следующее
От: "Chris Hoover"
Дата:
Сообщение: How to tell how long server has been up?