Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-23 Thread Tom Lane
"D'Arcy Cain" writes: > On 12-06-23 08:21 AM, Dickson S. Guedes wrote: >> Try in the search box of postgres doxygen documentation [1].. > That's source, not documentation. I already found it in the actual > source files but that's not the same thing. For one thing, if it > isn't documented then

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-23 Thread D'Arcy Cain
On 12-06-23 08:21 AM, Dickson S. Guedes wrote: Still nothing in the documentation. At least the search box doesn't find it. Try in the search box of postgres doxygen documentation [1].. That's source, not documentation. I already found it in the actual source files but that's not the same t

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-23 Thread Dickson S. Guedes
2012/6/23 D'Arcy Cain : > On 12-06-23 12:17 AM, Tom Lane wrote: >> >> "D'Arcy Cain" writes: >>> >>> On 12-06-22 07:09 PM, Robert Haas wrote: I think DirectionFunctionCall2 is what you want. >> >> >>> Can you elaborate?  I could not find a single hit in Google or the >>> documentation sea

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread D'Arcy Cain
On 12-06-23 12:17 AM, Tom Lane wrote: "D'Arcy Cain" writes: On 12-06-22 07:09 PM, Robert Haas wrote: I think DirectionFunctionCall2 is what you want. Can you elaborate? I could not find a single hit in Google or the documentation search on the PG site and it does not appear anywhere in the

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread Tom Lane
"D'Arcy Cain" writes: > On 12-06-22 07:09 PM, Robert Haas wrote: >> I think DirectionFunctionCall2 is what you want. > Can you elaborate? I could not find a single hit in Google or the > documentation search on the PG site and it does not appear anywhere > in the source distribution. He meant D

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread D'Arcy Cain
On 12-06-22 07:09 PM, Robert Haas wrote: I think DirectionFunctionCall2 is what you want. Can you elaborate? I could not find a single hit in Google or the documentation search on the PG site and it does not appear anywhere in the source distribution. -- D'Arcy J.M. Cain | Democracy

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread Robert Haas
On Fri, Jun 22, 2012 at 12:28 PM, D'Arcy Cain wrote: >> I doubt that an "auto reverse the arguments" facility would be very >> much cheaper.  You could maybe argue that the aggregated maintenance >> and space costs of all the commutator-pair functions are enough to >> justify having some such solu

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread D'Arcy Cain
On 12-06-22 11:36 AM, Tom Lane wrote: "D'Arcy Cain" writes: The thing is that either of those approaches is hugely more expensive than just providing a second C function. It costs probably thousands of cycles to inline that SQL function, each time it's used in a query. I assumed itwould be mo

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread Tom Lane
"D'Arcy Cain" writes: > ... The issue here is that the operator is SC but > the args are different types. Well, that's a weird way of defining self-commutating, but ... > It would be nice if there was a way > to automatically generate code that reverses arguments. Maybe such > a thing belongs i

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread D'Arcy Cain
On 12-06-22 07:11 AM, Florian Pflug wrote: On Jun22, 2012, at 06:32 , D'Arcy Cain wrote: So I have my type working now but I had to create a new C function that take the opposite argument order. Seems redundant but I could not see a better way. There isn't. Postgres itself contains a huge num

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-22 Thread Florian Pflug
On Jun22, 2012, at 06:32 , D'Arcy Cain wrote: > So I have my type working now but I had to create a new C function > that take the opposite argument order. Seems redundant but I could > not see a better way. There isn't. Postgres itself contains a huge number of such functions, e.g. for every *lt

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread D'Arcy Cain
On 12-06-22 12:22 AM, Tom Lane wrote: Um, an operator with different types on left and right cannot be its own commutator. Understood. I completely misunderstood the purpose of COMMUTATOR. I thought that it was telling the system that the procedure could be called with the arguments reversed

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread Tom Lane
"D'Arcy Cain" writes: > On 12-06-21 12:18 PM, Tom Lane wrote: >> Did you actually create a "text = chkpass" function and operator? >> This declaration merely promises that you will provide one eventually. >> The system does not have the ability to make one for you. > I guess I am missing the poin

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread D'Arcy Cain
On 12-06-21 12:18 PM, Tom Lane wrote: Did you actually create a "text = chkpass" function and operator? This declaration merely promises that you will provide one eventually. The system does not have the ability to make one for you. I guess I am missing the point of COMMUTATOR then. The docs s

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread Florian Pflug
On Jun21, 2012, at 17:46 , D'Arcy Cain wrote: > Maybe I am using it wrong but I get no error message when I use it. I > have a type called chkpass (a version is in the additional supplied > modules) and I create the equality operator like this: > ... > > So while it created the operator it didn

Re: [HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread Tom Lane
"D'Arcy Cain" writes: > Maybe I am using it wrong but I get no error message when I use it. I > have a type called chkpass (a version is in the additional supplied > modules) and I create the equality operator like this: > CREATE OPERATOR = ( > PROCEDURE = eq, > LEFTARG = chkpa

[HACKERS] COMMUTATOR doesn't seem to work

2012-06-21 Thread D'Arcy Cain
Maybe I am using it wrong but I get no error message when I use it. I have a type called chkpass (a version is in the additional supplied modules) and I create the equality operator like this: CREATE OPERATOR = ( PROCEDURE = eq, LEFTARG = chkpass, RIGHTARG = text,