Re: [HACKERS] Re: [PATCHES] ':' and ';' operators - Mailing list pgsql-hackers
From | Tom Lane |
---|---|
Subject | Re: [HACKERS] Re: [PATCHES] ':' and ';' operators |
Date | |
Msg-id | 13144.943544840@sss.pgh.pa.us Whole thread Raw |
In response to | Re: [PATCHES] ':' and ';' operators (Peter Eisentraut <e99re41@DoCS.UU.SE>) |
List | pgsql-hackers |
Peter Eisentraut <e99re41@DoCS.UU.SE> writes: >>>> This patch removes the ';' (logarithm) and ':' (exponentiation) operators, >>>> as was generally agreed upon. >> >> This is a tad premature IMHO. In the first place, we haven't got the >> replacement functions --- at least not with user-friendly names. >> In the second place, I think we oughta deprecate these things for a >> release or two before we actually remove 'em. > Deprecation is not going to work in this case because those two operators > interfere with their blessed SQL meaning. And now is the time to remove > them. The reason I wanted them removed now is that it is a pain to account > for them, or even disambiguate them, in psql. It's always been true (or at least been true for a long time) that ';' used as an operator has to appear inside parens, like "SELECT (;2)", to keep psql from thinking that it's a statement terminator. Can't you maintain that behavior? ':' is a little trickier --- if you want to use it to reference psql-provided variables, then there's probably no way you can support it as an SQL operator too. Of course ecpg must have the same problem. > At the risk of taking on more work and/or provoking a holy war, I think > the mathematical operators and function names need some cleaning up in > general. From the previous conversation on this topic I gathered that a > lot of these things are from PostQUEL times. Also, there is some confusion > between float and numeric operators and functions and sometimes they only > work on one, etc. I think most of the confusion in this area comes from the fact that while operators have always (?) been overloadable across types, up till 6.5 built-in functions had to have the same names in SQL as in the C code, and therefore the function names for different data types had to be different. The only way to overload a function name was to make an ugly (and slow) SQL function wrapper. So there was a strong notational advantage to using operator rather than function syntax for anything that was useful for more than one datatype. That problem's gone now. I'm not in favor of removing the operators, except maybe for ';' and ':', but I agree it'd be a fine idea to provide standardized function names across all the numeric data types, and to make sure that the operators that are there work on NUMERIC too. > I don't have the SQL standards around here, but they should be the > reference, SQL doesn't address math functions at all, AFAICS. Given that lack, the names used in C's <math.h> look OK to me, with the exception that I'd rather see abs() than fabs(). regards, tom lane
pgsql-hackers by date: