Creating a function index

From: "Michael Labhard" <ince(at)pacifier(dot)com>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: Creating a function index
Date: 2002-08-30 14:45:06
Message-ID: ako0ar$le$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Apparantly creating a function index does not work if there is a single
quote in the function expression? Example:

CREATE TABLE A (
x INTEGER
, y DATE
)
;

INSERT INTO A VALUES( 1, CURRENT_DATE );
INSERT INTO A VALUES( 2, CURRENT_DATE );
INSERT INTO A VALUES( 3, CURRENT_DATE );
INSERT INTO A VALUES( 4, CURRENT_DATE - CAST('1 day' AS INTERVAL) );
--INSERT INTO A VALUES( 4, CURRENT_DATE - CAST('2 day' AS INTERVAL) );
--INSERT INTO A VALUES( 4, CURRENT_DATE - CAST('3 day' AS INTERVAL) );

CREATE INDEX indx1 ON A( DATE_TRUNC('day', y) );

SELECT * FROM A WHERE y < CURRENT_DATE;

DROP INDEX indx1;
DROP TABLE A;

Please advise. Thanks.

-- Michael

Browse pgsql-cygwin by date

  From Date Subject
Next Message Henshall, Stuart - WCP 2002-08-30 15:15:33 Re: Creating a function index
Previous Message Kirsty Rivers 2002-08-30 14:11:54 !!L@@K!! SICK OF ALL THE LIES ME TO (A MUST READ)