pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jochem van Dieten <nomail@dev.null>
To: pgsql-sql@postgresql.org
Subject: Re: Error trying to create a functional index.
Date: Tue, 08 Jan 2002 12:27:28 +0100
Message-ID: <3C3AD7A0.9090304@dev.null> (raw)
References: <b01eaea0.0201030725.51661db3@posting.google.com>
	<a1229v$2a19$1@news.tht.net>
	<3C397FF1.20706@mportal.hu>

CoL wrote:

> Steve: of course you can make functional indices:
> 
> So why this not workin???? (not workin for me 2 too, pg 7.1.3)
> "CREATE INDEX eventdateindex ON event (date_trunc('day', eventstamp));"
> 
> ----------------
> 7.5. Functional Indices
> For a functional index, an index is defined on the result of a function 
> applied to one or more columns of a single table. Functional indices can 
> be used to obtain fast access to data based on the result of function 
> calls.
> For example, a common way to do case-insensitive comparisons is to use 
> the lower:
> SELECT * FROM test1 WHERE lower(col1) = 'value';
> In order for that query to be able to use an index, it has to be defined 
> on the result of the lower(column) operation:
> CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
> The function in the index definition can take more than one argument, 
> but they must be table columns, not constants.


Wouldn't your problem be that 'day' is a constant?

Jochem




view thread (5+ messages)  latest in thread

Message-ID: <3C3AD7A0.9090304@dev.null>
Permalink:  ../3C3AD7A0.9090304@dev.null/
Also on:    postgresql.org/message-id/3C3AD7A0.9090304@dev.null

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nomail@dev.null
  Subject: Re: Error trying to create a functional index.
  In-Reply-To: <3C3AD7A0.9090304@dev.null>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox