Re: Designing an extension for feature-space similarity search
От | Jay Levitt |
---|---|
Тема | Re: Designing an extension for feature-space similarity search |
Дата | |
Msg-id | 4F3D898B.2010603@gmail.com обсуждение исходный текст |
Ответ на | Re: Designing an extension for feature-space similarity search (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Designing an extension for feature-space similarity search
|
Список | pgsql-hackers |
Tom Lane wrote: >> - Can domains have operators, or are operators defined on types? > > I think the current state of play is that you can have such things but > the system will only consider them for exact type matches, so you might > need more explicit casts than you ordinarily would. Turns out it's even smarter than that; it seems to coerce when it's unambiguous: create domain birthdate as date; create function date_dist(birthdate, birthdate) returns integer as $$ select 123; $$ language sql; create operator <-> (procedure = date_dist,leftarg = birthdate,rightarg = birthdate); select '2012-01-01'::birthdate <-> '2012-01-01'::birthdate; -- 123 select '2012-01-01'::date <-> '2012-01-01'::date ; -- 123 create domain activity_date as date; create function date_dist(activity_date, activity_date) returns integer as $$ select 432; $$ language sql; create operator <-> (procedure = date_dist,leftarg = activity_date,rightarg = activity_date); select '2012-01-01'::activity_date <-> '2012-01-01'::activity_date; -- 432 select '2012-01-01'::birthdate <-> '2012-01-01'::birthdate; -- 123 select '2012-01-01'::date <-> '2012-01-01'::date ; -- ERROR: operator is not unique: date <-> date
В списке pgsql-hackers по дате отправления: