From: jose' soares <sferac@bo.nettuno.it>
To: Remigiusz Sokolowski <rems@gdansk.sprint.pl>
Cc: Sascha Schumann <sas@schell.de>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] index on aggregate function
Date: Mon, 15 Feb 1999 13:07:59 +0100
Message-ID: <36C80E1F.D9202F72@bo.nettuno.it> (raw)
References: <Pine.GS4.4.02A.9902150853400.16896-100000@netra.gdansk.sprint.pl>
Remigiusz Sokolowski ha scritto:
> > > > I somewhere read that it is possible to create an index on aggregate functions
> > > > in PostgreSQL. Which syntax do I have to use for it?
> > > >
> > > > test=> CREATE TABLE test ( name VARCHAR(32) );
> > > > CREATE
> > > > test=> CREATE INDEX test_idx ON test lower(name);
> > > > ERROR: parser: parse error at or near "lower"
> > > >
> > > > gives me a parser error.
> > >
> > > Right syntax is
> > > CREATE INDEX test_idx ON test (lower(name) text_ops);
> > > I try it and index was generated without error
> > > Rem
> >
> > Well, that exact statement gives me:
> >
> > ERROR: BuildFuncTupleDesc: function 'lower(varchar)' does not exist
> >
> > I also tried varchar_ops and char_ops instead of text_ops, but that does not
> > resolve the problem. I'm using PostgreSQL 6.4.2 on Linux without problems so
> > far.
>
> I have holidays and now have to read so much mails, that I can't find if
> there were any other suggestions about that. AFAIK there is no lower()
> function for varchar type and this is a problem - solution is to use text
> type or create function lower() for varchar type.
> Rem
>
> -------------------------------------------------------------------*------------
> Remigiusz Sokolowski e-mail: rems@gdansk.sprint.pl * *
> -----------------------------------------------------------------*****----------
--lower() works with varchar...
prova=> CREATE TABLE test ( name VARCHAR(32) );
CREATE
prova=> insert into test values ('AAAA');
INSERT 188475 1
prova=> select lower(name) from test;
lower
-----
aaaa
(1 row)
but it doesn't work on create index...
prova=> drop table test;
DROP
prova=> CREATE TABLE test ( name VARCHAR(32) );
CREATE
prova=> CREATE INDEX test_idx ON test lower(nome);
ERROR: parser: parse error at or near "lower"
--
- Jose' -
And behold, I tell you these things that ye may learn wisdom; that ye may
learn that when ye are in the service of your fellow beings ye are only
in the service of your God. - Mosiah 2:17 -
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: sferac@bo.nettuno.it, rems@gdansk.sprint.pl, sas@schell.de, pgsql-sql@hub.org
Subject: Re: [SQL] index on aggregate function
In-Reply-To: <36C80E1F.D9202F72@bo.nettuno.it>
References: <Pine.GS4.4.02A.9902150853400.16896-100000@netra.gdansk.sprint.pl> <36C80E1F.D9202F72@bo.nettuno.it>
* 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