[SQL] casting BOOL to somthng

2004-08-31 Thread sad
hello why BOOL can not be casted to TEXT ...nevertheless BOOL has a textual (output) representation 't' and 'f' letters why not to use this fact to define cast to TEXT ? ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 6:06 PM, sad wrote: why BOOL can not be casted to TEXT nevertheless BOOL has a textual (output) representation 't' and 'f' letters why not to use this fact to define cast to TEXT ? I'm not sure of the reason why there isn't a built-in cast from boolean to text, though I'm

[SQL] colored PL with emacs

2004-08-31 Thread Martin Marques
Does anyone know of a .el file that can be used with Emacs to get colored coding when working with PL/pgSQL? -- 08:40:01 up 8 days, 27 min, 1 user, load average: 2.53, 2.09, 1.70 - Martín Marqués| select 'mmarques' || '@'

[SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Hi, The docs says that numeric type supports numbers upto any precision 8.1.2. Arbitrary Precision Numbers The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where

Re: [SQL] colored PL with emacs

2004-08-31 Thread Stephen Quinney
On Tue, Aug 31, 2004 at 08:42:44AM -0300, Martin Marques wrote: > Does anyone know of a .el file that can be used with Emacs to get colored > coding when working with PL/pgSQL? > Emacs 21.3 (and possibly earlier versions) comes with an SQL mode which I know has a PostgreSQL keyword highlighting

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread sad
you wrote: > you can use CREATE CAST to make your own cast from boolean to text. thnx it helps. and i am still desire to know _WHY_ there are no predefined cast for BOOL ? and at the same time there are predefined casts for INT and FLOAT.. ---(end of broadcast)

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 8:55 PM, Rajesh Kumar Mallah wrote: The docs says that numeric type supports numbers upto any precision However tradein_clients=# SELECT cast(2^100 as numeric); 1. Does the specs not require pgsql to print a warning or info , will it not be considered silient truncation of

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Geoffrey
sad wrote: you wrote: you can use CREATE CAST to make your own cast from boolean to text. thnx it helps. and i am still desire to know _WHY_ there are no predefined cast for BOOL ? and at the same time there are predefined casts for INT and FLOAT.. I'd like to understand in what context you w

Re: [SQL] colored PL with emacs

2004-08-31 Thread Martin Marques
El Mar 31 Ago 2004 09:11, Stephen Quinney escribió: > On Tue, Aug 31, 2004 at 08:42:44AM -0300, Martin Marques wrote: > > Does anyone know of a .el file that can be used with Emacs to get colored > > coding when working with PL/pgSQL? > > Emacs 21.3 (and possibly earlier versions) comes with an SQL

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Michael Glaesemann wrote: On Aug 31, 2004, at 8:55 PM, Rajesh Kumar Mallah wrote: The docs says that numeric type supports numbers upto any precision However tradein_clients=# SELECT cast(2^100 as numeric); 1. Does the specs not require pgsql to print a warning or info , will it not be consi

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric arguments and returns numeric.

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Michael Glaesemann wrote: On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric arguments and returns numeric.

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 8:24 PM, sad wrote: and i am still desire to know _WHY_ there are no predefined cast for BOOL ? and at the same time there are predefined casts for INT and FLOAT.. I think the main reason is what is the proper textual representation of BOOLEAN? True, PostgreSQL returns 't'

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 9:15 AM, Rajesh Kumar Mallah wrote: Michael Glaesemann wrote: On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 11:18 PM, Jan Wieck wrote: I agree that doing select 2::numeric ^ 100; should emit some sort of a warning. Because what happens here is that the numeric value is degraded to a float8 in order to use the operator. Would this be solved by overloading the ^ operator with the

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > I agree that doing > select 2::numeric ^ 100; > should emit some sort of a warning. I do not. The conversion of 2::numeric to float is exact, so AFAICS the only way to do that would be to make *every* coercion of numeric to float emit a warning. This

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 11:04 AM, Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: I agree that doing select 2::numeric ^ 100; should emit some sort of a warning. I do not. The conversion of 2::numeric to float is exact, so AFAICS the only way to do that would be to make *every* coercion of numeric

Re: [SQL] colored PL with emacs

2004-08-31 Thread Manuel Sugawara
Martin Marques <[EMAIL PROTECTED]> writes: > I have SQL highlighting, but what I want are colors for the PL/pgSQL > key words. It would make PL programming much easier. Since the Pl/PgSQL code is quoted (x)emacs paints the whole thing using the string face. Delete one of the apostrophes delimitin

Re: [SQL] colored PL with emacs

2004-08-31 Thread Josh Berkus
Martin, > > I have SQL highlighting, but what I want are colors for the PL/pgSQL > > key words. It would make PL programming much easier. KDE's Kate has PostgreSQL highlighting. Unfortunately, the config is XML so it's not transferrable to Emacs ... -- --Josh Josh Berkus Aglio Database Solut

Re: [SQL] colored PL with emacs

2004-08-31 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I have SQL highlighting, but what I want are colors for the PL/pgSQL > key words. It would make PL programming much easier. There's nothing out there. but writing one is on my long-term TODO list. > KDE's Kate has PostgreSQL highlighting. Un

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread sad
On Tuesday 31 August 2004 16:22, Geoffrey wrote: > sad wrote: > > you wrote: > >>you can use CREATE CAST to make your own cast from boolean to text. > > > > thnx it helps. > > > > and i am still desire to know _WHY_ there are no predefined cast for BOOL > > ? and at the same time there are predefin

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread sad
On Tuesday 31 August 2004 17:49, Michael Glaesemann wrote: > On Aug 31, 2004, at 8:24 PM, sad wrote: > > and i am still desire to know _WHY_ there are no predefined cast for > > BOOL ? > > and at the same time there are predefined casts for INT and FLOAT.. > > I think the main reason is what is

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Stephan Szabo
On Wed, 1 Sep 2004, sad wrote: > On Tuesday 31 August 2004 17:49, Michael Glaesemann wrote: > > On Aug 31, 2004, at 8:24 PM, sad wrote: > > > and i am still desire to know _WHY_ there are no predefined cast for > > > BOOL ? > > > and at the same time there are predefined casts for INT and FLOAT...

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread sad
On Wednesday 01 September 2004 09:24, Stephan Szabo wrote: > On Wed, 1 Sep 2004, sad wrote: > > On Tuesday 31 August 2004 17:49, Michael Glaesemann wrote: > > > On Aug 31, 2004, at 8:24 PM, sad wrote: > > > > and i am still desire to know _WHY_ there are no predefined cast for > > > > BOOL ? > > >

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Michael Glaesemann
On Sep 1, 2004, at 2:41 PM, sad wrote: On Wednesday 01 September 2004 09:24, Stephan Szabo wrote: There's a fairly accepted convention for integer representations. There's no such convention for boolean representations. then why do you print its value on a screen ?! Perhaps because if you don't pri

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread sad
On Wednesday 01 September 2004 10:38, Michael Glaesemann wrote: > On Sep 1, 2004, at 2:41 PM, sad wrote: > > On Wednesday 01 September 2004 09:24, Stephan Szabo wrote: > >> There's a fairly accepted convention for integer representations. > >> There's no such convention for boolean representations.

Re: [SQL] casting BOOL to somthng

2004-08-31 Thread Peter Eisentraut
sad wrote: > since you printed it you poke a convention (of casting to string) > > if you can print it on screen why not to print it in string? Allow me an attempt at a philosophical explanation: The external representation to the API is arbitrary, because it's part of the API specification, and