X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6E4EED1F358 for ; Thu, 6 May 2004 20:48:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 11037-02 for ; Thu, 6 May 2004 20:48:01 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 1B593D1F330 for ; Thu, 6 May 2004 20:46:36 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i46NkXSx080275 for ; Thu, 6 May 2004 23:46:33 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i46Nbbtd066113 for pgsql-admin@postgresql.org; Thu, 6 May 2004 23:37:37 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.admin Subject: cast not IMMUTABLE? Date: Fri, 07 May 2004 01:37:29 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 42 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/62 X-Sequence-Number: 13378 Hi all, I have a table with ~ 3e+6 rows on it. I do select on this table in this way: (1) select * from user_logs where login_time::date = now()::date; consider that login_time is a TIMESTAMPTZ with an index on it. If I use the select in this way: select * from user_logs where login_time = now(); the the index is used. I'm trying to use define and index in order to help the query (1): test# create index idx on user_logs ( (login_time::date) ); ERROR: functions in index expression must be marked IMMUTABLE why that cast is not considered IMMUTABLE ? How can I define an index for the query (1) ? Regards Gaetano Mendola