CREATE INDEX question (how to index on "money" field?)
| От | charette@writeme.com (Stephane Charette) |
|---|---|
| Тема | CREATE INDEX question (how to index on "money" field?) |
| Дата | |
| Msg-id | 1be4bb40.0310112317.4683a3dc@posting.google.com обсуждение исходный текст |
| Список | 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
В списке pgsql-general по дате отправления: