Note: m4 is being used so "_" prefixed strings are expanded (m4 is a macro pre-processor similar to the c preprocessor).
My Type:
CREATE TYPE UrlPair AS (
HostName varchar( _LIMIT_HOSTNAME ),
ScriptName varchar( _LIMIT_SCRIPTNAME )
);
Used in
CREATE TABLE SymbolTable_UrlPair (
Symbol _BIG_SYMBOL_SERIAL_TYPE PRIMARY KEY,
UrlPair UrlPair
);
With index
CREATE INDEX SymbolTable_UrlPair_UrlPair
ON SymbolTable_UrlPair USING hash (UrlPair);
Gives:
psql:script:32: ERROR: data type urlpair has no default operator class
for access method "hash"
HINT: You must specify an operator class for the index or define a default
operator class for the data type.
Question
Ideally I would like the engine to concatinate the strings and use that for a hash. However, I am not fussy. Could someone show me the syntax for declaring this "Operator Class" for the access method hash.
I would have expected some default hashing behaviour for user defined types. I would really preffer to keep the type -- i.e., I don't want to expand it, as I will probably define a few more elaborate UDT's.