Comparing arrays of composite types
От | Alban Hertroys |
---|---|
Тема | Comparing arrays of composite types |
Дата | |
Msg-id | C617F9AB-13B0-4F2A-9230-FFD65A5B9B2D@solfertje.student.utwente.nl обсуждение исходный текст |
Ответы |
Re: Comparing arrays of composite types
Re: Comparing arrays of composite types |
Список | pgsql-general |
Hello all, I'm running into a small problem (while comparing tokenised unit strings in case you're interested) with said topic. I defined a type: CREATE TYPE unit_token AS ( base_unit TEXT, unit_base INT ); In my table I have: CREATE TABLE unit ( unit TEXT NOT NULL PRIMARY KEY, tokens unit_token[] NOT NULL ); If I try to join on tokens or try to create an index over that column I get: "ERROR: could not identify a comparison function for type unit_token". I can compare columns of type unit_token (not the array) just fine, and even joining on tokens[1] works as expected - and not just for equality but also less-than (didn't test the remainder, I assume they work). I have created operators on unit_token for =, <, <=, > and >=, but either I did something wrong defining my operators or the error is pointing to some other problem. I noticed casting both sides to text works just fine, but I'd prefer to do this 'properly' if possible. Any pointers as to what is going wrong here? One other thing of note is that the error doesn't appear to be about a missing comparison operator for unit_token, but rather for unit_token[]. Alban Hertroys -- Screwing up is the correct approach to attaching something to the ceiling. !DSPAM:737,4a8eee7b10131407718702!
В списке pgsql-general по дате отправления: