On Thu, Jun 28, 2012 at 8:59 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> A potential workaround is illustrated by:
>
> regression=# create index foobari on foobar (foosum(row(foobar.*)::foo));
> CREATE INDEX
> regression=# \d foobari
> Index "public.foobari"
> Column | Type | Definition
> --------+---------+--------------------------
> foosum | integer | foosum(ROW(f1, f2)::foo)
> btree, for table "public.foobar"
Thank you, Tom. It is a good idea. I need it for partitioning. So I am
going to create a parent table and the first partition with this
whole-row casted to the parent's type in index. Other partitions will
be created by CREATE...LIKE.
> but this seems like kind of a kluge. I'm not sure that we ought to
> insert such a thing rather than just throwing an error.
May be this issue and workaround is worth to be mentioned in docs
besides throwing an error?
--
Sergey Konoplev
a database architect, software developer at PostgreSQL-Consulting.com
http://www.postgresql-consulting.com
Jabber: gray.ru@gmail.com Skype: gray-hemp Phone: +79160686204