From: | charette(at)writeme(dot)com (Stephane Charette) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | CREATE INDEX question (how to index on "money" field?) |
Date: | 2003-10-12 07:17:29 |
Message-ID: | 1be4bb40.0310112317.4683a3dc@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
QUICK VERSION: How do I create an index on a field of type "MONEY"?
-----------------------------
LONG VERSION:
I have a table with a field of type "money". I very often need to
access records by the purchase price so I thought I'd create an index
to help out my selects:
CREATE INDEX purchasepriceidx ON mytable (purchaseprice);
This results in the following:
ERROR: data type money has no default operator class for access
method "btree" You must specify an operator class for the
index or define a default operator class for the data type
So if I understand this message correctly, it means that "money" has
no comparison operators associated with it? I RTFM'd and found the 51
available operators (SELECT am.amname AS acc_method, opc.opcname AS
ops_name FROM pg_am am, pg_opclass opc WHERE opc.opcamid = am.oid
ORDER BY acc_method, ops_name), but I don't see anything here that
seems to relate to "money" type fields. Am I correct about my
assuptions? Anyone have suggestions they can share? Any simple
examples posted anywhere?
PostgreSQL 7.3.4 on i586-pc-linux-gnu, compiled by GCC 2.96
Thanks,
Stephane Charette
stephanecharette @@@ telus ... net
From | Date | Subject | |
---|---|---|---|
Next Message | btober | 2003-10-12 08:48:56 | Temporary tables and miscellaneous schemas |
Previous Message | Tom Lane | 2003-10-12 05:21:22 | Re: more on undefined reference to 'pg_detoast_datum' and libpq |