Search Postgresql Archives

Exclusion constraint issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm getting an error message that doesn't make sense to me. Using PostgreSQL 9.0.0 on CentOS 5.5.


Given the following table and function definitions

CREATE TABLE test3
(
  test3_id serial NOT NULL,
  fk_id integer,
  data_3 text,
  effect_date date NOT NULL,
  expire_date date NOT NULL,
  CONSTRAINT test3_pkey PRIMARY KEY (test3_id)
)

CREATE OR REPLACE FUNCTION period(timestamp with time zone, timestamp with time zone)
  RETURNS period AS
$BODY$
    SELECT CASE WHEN $1 <= $2
    THEN ($1, $2)::period
    ELSE ($2, $1)::period END;
$BODY$
  LANGUAGE sql IMMUTABLE STRICT


and the period datatype with it's associated functions and operators installed from http://pgfoundry.org/projects/timespan/

why would I get the following error, since the period() function is in fact declared as immutable?

test=# ALTER TABLE test3 ADD exclude using gist(period(effect_date::timestamptz, expire_date::timestamptz) with && );
ERROR:  functions in index _expression_ must be marked IMMUTABLE

Thanks in advance for any assistance.
-Eric

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux