More outdated examples
More outdated examples
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
This example in User's Guide section 7.2 doesn't work anymore at all: tgl=> select @ text '-4.5' as "abs";abs -----4.5 (1 row) What really happens is this: => select @ text '-4.5' as "abs"; ERROR: Unable to identify a prefix operator '@' for type 'text' You may need to add parentheses or an explicit cast Again, delete or new example? -- Peter Eisentraut peter_e@gmx.net
Re: More outdated examples
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
I can find no suitable replacement for this example. Can anyone else? --------------------------------------------------------------------------- Peter Eisentraut wrote: > This example in User's Guide section 7.2 doesn't work anymore at all: > > tgl=> select @ text '-4.5' as "abs"; > abs > ----- > 4.5 > (1 row) > > What really happens is this: > > => select @ text '-4.5' as "abs"; > ERROR: Unable to identify a prefix operator '@' for type 'text' > You may need to add parentheses or an explicit cast > > Again, delete or new example? > > -- > Peter Eisentraut peter_e@gmx.net > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Re: More outdated examples
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian writes: > I can find no suitable replacement for this example. Can anyone else? > Peter Eisentraut wrote: >> This example in User's Guide section 7.2 doesn't work anymore at all: >> >> tgl=> select @ text '-4.5' as "abs"; Both of the examples in this section have been obsoleted by our recent elimination of a lot of implicit casts. This one would still work if text-to-float8 were an implicit cast, but it's not anymore. Also, though the second one still acts as described, the reason given for it in the text is wrong: the system is not unable to choose among multiple alternatives. Rather, it finds *no* alternatives, again because the text-to-various-int-types casts are no longer implicit. The closest similar cases that I can find for the first example are not good replacements because they are also slated for destruction :-(. Basically, I see us moving away from the preferred-type mechanism, and perhaps eliminating it entirely soon. I'd just remove the whole of Example 7.3, I think. The mechanisms are still there, for now, but they are not invoked in any standard cases. regards, tom lane
Re: More outdated examples
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
The following applied patch removes the section Tom thought wasn't
needed anymore.
---------------------------------------------------------------------------
Tom Lane wrote:
> Bruce Momjian writes:
> > I can find no suitable replacement for this example. Can anyone else?
>
> > Peter Eisentraut wrote:
> >> This example in User's Guide section 7.2 doesn't work anymore at all:
> >>
> >> tgl=> select @ text '-4.5' as "abs";
>
> Both of the examples in this section have been obsoleted by our recent
> elimination of a lot of implicit casts. This one would still work if
> text-to-float8 were an implicit cast, but it's not anymore. Also,
> though the second one still acts as described, the reason given for it
> in the text is wrong: the system is not unable to choose among multiple
> alternatives. Rather, it finds *no* alternatives, again because the
> text-to-various-int-types casts are no longer implicit.
>
> The closest similar cases that I can find for the first example are not
> good replacements because they are also slated for destruction :-(.
> Basically, I see us moving away from the preferred-type mechanism, and
> perhaps eliminating it entirely soon.
>
> I'd just remove the whole of Example 7.3, I think. The mechanisms are
> still there, for now, but they are not invoked in any standard cases.
>
> regards, tom lane
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/typeconv.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/typeconv.sgml,v
retrieving revision 1.27
diff -c -c -r1.27 typeconv.sgml
*** doc/src/sgml/typeconv.sgml 13 Mar 2003 01:30:29 -0000 1.27
--- doc/src/sgml/typeconv.sgml 19 Mar 2003 21:17:32 -0000
***************
*** 403,459 ****
-
- Absolute-Value and Factorial Operator Type Resolution
-
-
- The PostgreSQL operator catalog has several
- entries for the prefix operator @</>, all of which implement
- absolute-value operations for various numeric data types. One of these
- entries is for type float8, which is the preferred type in
- the numeric category. Therefore, PostgreSQL
- will use that entry when faced with a non-numeric input:
-
- SELECT @ '-4.5' AS "abs";
- abs
- -----
- 4.5
- (1 row)
-
- Here the system has performed an implicit conversion from text to float8
- before applying the chosen operator. We can verify that float8 and
- not some other type was used:
-
- SELECT @ '-4.5e500' AS "abs";
-
- ERROR: Input '-4.5e500' is out of range for float8
-
-
-
-
- On the other hand, the postfix operator !</> (factorial)
- is defined only for integer data types, not for float8. So, if we
- try a similar case with !</>, we get:
-
- SELECT '20' ! AS "factorial";
-
- ERROR: Unable to identify a postfix operator '!' for type 'text'
- You may need to add parentheses or an explicit cast
-
- This happens because the system can't decide which of the several
- possible !</> operators should be preferred. We can help
- it out with an explicit cast:
-
- SELECT CAST('20' AS int8) ! AS "factorial";
-
- factorial
- ---------------------
- 2432902008176640000
- (1 row)
-
-
-
-
--- 403,408 ----
Re: More outdated examples
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
The specific case that Tom complained about wasn't even in the latest documentation sources anymore. I think the patch should be reverted. Bruce Momjian writes: > > The following applied patch removes the section Tom thought wasn't > needed anymore. > > --------------------------------------------------------------------------- > > Tom Lane wrote: > > Bruce Momjian writes: > > > I can find no suitable replacement for this example. Can anyone else? > > > > > Peter Eisentraut wrote: > > >> This example in User's Guide section 7.2 doesn't work anymore at all: > > >> > > >> tgl=> select @ text '-4.5' as "abs"; > > > > Both of the examples in this section have been obsoleted by our recent > > elimination of a lot of implicit casts. This one would still work if > > text-to-float8 were an implicit cast, but it's not anymore. Also, > > though the second one still acts as described, the reason given for it > > in the text is wrong: the system is not unable to choose among multiple > > alternatives. Rather, it finds *no* alternatives, again because the > > text-to-various-int-types casts are no longer implicit. > > > > The closest similar cases that I can find for the first example are not > > good replacements because they are also slated for destruction :-(. > > Basically, I see us moving away from the preferred-type mechanism, and > > perhaps eliminating it entirely soon. > > > > I'd just remove the whole of Example 7.3, I think. The mechanisms are > > still there, for now, but they are not invoked in any standard cases. > > > > regards, tom lane > > > > -- Peter Eisentraut peter_e@gmx.net
Re: More outdated examples
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
OK, readded. Thanks. --------------------------------------------------------------------------- Peter Eisentraut wrote: > The specific case that Tom complained about wasn't even in the latest > documentation sources anymore. I think the patch should be reverted. > > Bruce Momjian writes: > > > > > The following applied patch removes the section Tom thought wasn't > > needed anymore. > > > > --------------------------------------------------------------------------- > > > > Tom Lane wrote: > > > Bruce Momjian writes: > > > > I can find no suitable replacement for this example. Can anyone else? > > > > > > > Peter Eisentraut wrote: > > > >> This example in User's Guide section 7.2 doesn't work anymore at all: > > > >> > > > >> tgl=> select @ text '-4.5' as "abs"; > > > > > > Both of the examples in this section have been obsoleted by our recent > > > elimination of a lot of implicit casts. This one would still work if > > > text-to-float8 were an implicit cast, but it's not anymore. Also, > > > though the second one still acts as described, the reason given for it > > > in the text is wrong: the system is not unable to choose among multiple > > > alternatives. Rather, it finds *no* alternatives, again because the > > > text-to-various-int-types casts are no longer implicit. > > > > > > The closest similar cases that I can find for the first example are not > > > good replacements because they are also slated for destruction :-(. > > > Basically, I see us moving away from the preferred-type mechanism, and > > > perhaps eliminating it entirely soon. > > > > > > I'd just remove the whole of Example 7.3, I think. The mechanisms are > > > still there, for now, but they are not invoked in any standard cases. > > > > > > regards, tom lane > > > > > > > > > -- > Peter Eisentraut peter_e@gmx.net > > > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073