From: Andres Freund <andres@anarazel.de>
To: pgsql-performance@postgresql.org
Cc: Desmond Coertzen <patrolliekaptein@gmail.com>
Subject: Re: Create index on subfield returned by function that returns base type with sub fields
Date: Thu, 23 Dec 2010 18:03:33 +0100
Message-ID: <201012231803.33978.andres@anarazel.de> (raw)
In-Reply-To: <AANLkTinFwyaExnh+H25nB0vGDFftau19b4GNJkoqqHdP@mail.gmail.com>
References: <AANLkTinFwyaExnh+H25nB0vGDFftau19b4GNJkoqqHdP@mail.gmail.com>
Hi,
On Thursday 23 December 2010 17:53:24 Desmond Coertzen wrote:
> Is is possible to create an index on a field on a function that returns a
> data type that contains subfields?
> Is this possible? How would I write the statement?
I am not sure I understood you correctly. Maybe you mean something like that:
test=# CREATE FUNCTION blub(IN int, OUT a int, OUT b int) RETURNS record
IMMUTABLE LANGUAGE sql AS $$SELECT $1+1, $1+2$$;
CREATE FUNCTION
Time: 1.665 ms
test=# CREATE INDEX foo__blub ON foo (((blub(data)).a));
CREATE INDEX
Time: 86.393 ms
Btw, this is the wrong list for this sort of question. The right place would
be -general.
Andres
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-performance@postgresql.org
Cc: andres@anarazel.de, patrolliekaptein@gmail.com
Subject: Re: Create index on subfield returned by function that returns base type with sub fields
In-Reply-To: <201012231803.33978.andres@anarazel.de>
* 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