problem creating rtree index on timestamptz - Mailing list pgsql-bugs

From Hussein Patni
Subject problem creating rtree index on timestamptz
Date
Msg-id a4418a0a181921ecea6c4e5fda6f46d8@cosbit.com
Whole thread Raw
Responses Re: problem creating rtree index on timestamptz  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

    I was trying to create a functional index on a timestamptz column and=20
had the following problem. It seems subraction of an interval from a=20
timestamptz is not immutable. Should this be the case?

foo=3D> create table timestamp_tz_test ( start timestamptz primary key );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index=20
"timestamp_tz_test_pkey" for table "timestamp_tz_test"
CREATE TABLE
=A0
foo=3D> create INDEX idx_timestamptz_rtree on timestamp_tz_test using=20
rtree ((start - '15 minutes'::INTERVAL));
ERROR:  functions in index expression must be marked IMMUTABLE


    I then tried a similar task with just at timestamp column and got this=20
error:

foo=3D> create table timestamp_test ( start timestamp primary key );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index=20
"timestamp_test_pkey" for table "timestamp_test"
CREATE TABLE
=A0
foo=3D> create INDEX idx_timestamp_rtree on timestamp_test using rtree=20
((start - '15 minutes'::INTERVAL));
ERROR:  data type timestamp without time zone has no default operator=20
class for access method "rtree"
HINT:  You must specify an operator class for the index or define a=20
default operator class for the data type.

Should there be a default for this?

Thanks in advance,

- --hussein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCI44ZI2IgiXMhqe4RAnHvAKC9o2xHmfdQ0MuYJ8XWK3v9uxf5IgCgnCuk
tD2jJUIWaGlPtbiBcByE1HU=3D
=3DayoM
-----END PGP SIGNATURE-----

pgsql-bugs by date:

Previous
From: "ZOUARI Fourat"
Date:
Subject: BUG #1511: RPM install, PHP5
Next
From: Tom Lane
Date:
Subject: Re: problem creating rtree index on timestamptz