Unix Technical Forum

Re: [BUGS] Bug in create operator and/or initdb

This is a discussion on Re: [BUGS] Bug in create operator and/or initdb within the pgsql Hackers forums, part of the PostgreSQL category; --> "John Hansen" <john@geeknet.com.au> writes: > CREATE FUNCTION my_func (inet, inet) as '$libdir/my_func.so' LANGUAGE 'C' IMMUTABLE STRICT; > CREATE OPERATOR ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:32 AM
Tom Lane
 
Posts: n/a
Default Re: [BUGS] Bug in create operator and/or initdb

"John Hansen" <john@geeknet.com.au> writes:
> CREATE FUNCTION my_func (inet, inet) as '$libdir/my_func.so' LANGUAGE 'C' IMMUTABLE STRICT;
> CREATE OPERATOR <<< (
> PROCEDURE = my_func,
> LEFTARG = cidr,
> RIGHTARG = cidr,
> RESTRICT = contsel,
> JOIN = contjoinsel
> );


> ERROR: function my_func(cidr, cidr) does not exist


Right ...

> Now, if you look at the catalog, and the < (less than operator) as an example you will see that:


> Two operators are defined for < - one for inet,inet and another for cidr,cidr.
> Only one function exists named network_lt, and is declared as taking (inet,inet) as arguments.


My opinion is that this is a very bogus shortcut in the network datatype
code. There are no cases outside the inet/cidr group where an operator
doesn't exactly match its underlying function. (The whole business of
inet and cidr being almost but not quite the same type is maldesigned
anyway...)

The right solution for you is to declare two SQL functions. Whether you
make them point at the same underlying C code is up to you.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:39 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com