[SQL] create type input and output function examples

2003-10-28 Thread Clint Stotesbery
I've seen the docs for create type and an example of the syntax to create a type. What I haven't seen is the functions that are passed for the input and output elements. CREATE TYPE box (INTERNALLENGTH = 8, INPUT = my_procedure_1, OUTPUT = my_procedure_2); Now what would be in my_procedure1 a

[SQL] SOLVED: Emulating 'connect by prior' using stored proc

2003-10-28 Thread Merrall, Graeme
First off, props for this go to Chris Wenham from his Live Journal post http://www.livejournal.com/users/terrulen/6008.html. He's happy for me to pass on the secrets :) Standard disclaimer applies but it worked well for me with no mods to our table structure although I had to adjust the function

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread Christopher Browne
[EMAIL PROTECTED] (SZUCS Gábor) writes: > As Tom pointed out, it isn't a floating point failure -- it is how rounding > float is implemented. I assume anything with less than 15 digits can be > exactly represented as float. No, "decimal" fractions cannot ever be exactly represented in floating poi

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread Bruno Wolff III
On Tue, Oct 28, 2003 at 21:16:53 +0100, SZUCS Gábor <[EMAIL PROTECTED]> wrote: > > As Tom pointed out, it isn't a floating point failure -- it is how rounding > float is implemented. I assume anything with less than 15 digits can be > exactly represented as float. No. It has to be a dyadic numb

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread SZUCS Gábor
- Original Message - From: "Greg Stark" <[EMAIL PROTECTED]> Sent: Tuesday, October 28, 2003 7:21 PM > > > cannot see is that the float values are not actually exactly 0.5 > > > > Yes I could guess that (floating point vs fixed), but is this a coincidence > > that both '0.5'::float and '-

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread Greg Stark
"SZÛCS Gábor" <[EMAIL PROTECTED]> writes: > > cannot see is that the float values are not actually exactly 0.5 > > Yes I could guess that (floating point vs fixed), but is this a coincidence > that both '0.5'::float and '-0.5'::float are closer to 0, whereas they could > be closer to +/-1, as we

Re: [SQL] URGENT!!! changing Column size

2003-10-28 Thread SZUCS Gábor
I have a php script that patches database, comparing pg_catalog's tables to input files. One thing it can do, but I can't take responsibility ;) is changing the type of a column. It's basically the same that everyone wrote, except that I also examine dependencies, as broad an examination as I coul

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread SZŰCS Gábor
Dear Ken, reply goes to the list if you don't mind :) - Original Message - From: "Kenneth Marshall" <[EMAIL PROTECTED]> To: "SZŰCS Gábor" <[EMAIL PROTECTED]> Sent: Tuesday, October 28, 2003 4:45 PM > Postgres is using the standard definition of rounding. What you The "standard" defini

Re: [SQL] numeric and float converts to int differently?

2003-10-28 Thread Tom Lane
"=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?=" <[EMAIL PROTECTED]> writes: > QUESTION 1: Is it intentional that converting 0.5 to int4 > - from numeric: rounds *away from* zero > - from float: rounds *towards* zero (tried float4 and float8 too)? Numeric currently rounds away from zero. We cannot guarantee t

Re: [SQL] bug in working with TEXT constants ?

2003-10-28 Thread Tom Lane
sad <[EMAIL PROTECTED]> writes: > Then I expect natural possibility to store texts having zero characters. You expect wrong; we don't support embedded nulls in text values, nor in literal strings. You can store nulls in BYTEA fields, but you have to use bytea's escaping conventions to represent t

Re: [SQL] bug in working with TEXT constants ?

2003-10-28 Thread Stephan Szabo
On Tue, 28 Oct 2003, sad wrote: > Good day. > > AFAIK PostgreSQL provides the type TEXT with 4-byte prefix length > which is distinct to C's zero-terminated (char *) > That's very good. > Then I expect natural possibility to store texts having zero characters. If you want to store zero character

[SQL] numeric and float converts to int differently?

2003-10-28 Thread SZŰCS Gábor
Dear Gurus, I'm using PostgreSQL 7.3.3. I was wondering if this is undefined, intentional or to be changed/fixed in the future. See the snippit at the end of this mail. QUESTION 1: Is it intentional that converting 0.5 to int4 - from numeric: rounds *away from* zero - from float: rounds *towards

Re: [SQL] connectby

2003-10-28 Thread Joe Conway
BenLaKnet wrote: I use postgresql 7.2.3 How can I use connectby ?? Must I install files ? or packages ? or it is recommanded to upgrade dataserver ? You need to upgrade. Either install 7.3.4 or wait a few weeks and install 7.4 when it is released. Joe ---(end of broadc

Re: [SQL] URGENT!!! changing Column size

2003-10-28 Thread Christoph Haller
> > On Tuesday 28 October 2003 08:28, Franco Bruno Borghesi wrote: > > Dopping the whole database just for a column change? > > I guess some people have really small databases that don't take 3 days to dump > and reload. :-) > And you are on the safe side regarding indexes, views, procedures,

Re: [SQL] connectby

2003-10-28 Thread BenLaKnet
I use postgresql 7.2.3 How can I use connectby ?? Must I install files ? or packages ? or it is recommanded to upgrade dataserver ? George Essig wrote: hi I have menu table: id | integer | not null default nextval('public.menu_id_seq'::text) parent_id | integer |

Re: [SQL] URGENT!!! changing Column size

2003-10-28 Thread D'Arcy J.M. Cain
On Tuesday 28 October 2003 08:28, Franco Bruno Borghesi wrote: > Dopping the whole database just for a column change? I guess some people have really small databases that don't take 3 days to dump and reload. :-) -- D'Arcy J.M. Cain <[EMAIL PROTECTED]|vex}.net> | Democracy is three wolves h

Re: [SQL] URGENT!!! changing Column size

2003-10-28 Thread Franco Bruno Borghesi
Dopping the whole database just for a column change? On Tue, 2003-10-28 at 10:00, Theodore Petrosky wrote: why not just pg_dump dbname > olddb.out pico olddb.out edit the section that defines the table save and exit dropdb dbname createdb dbname psql dbname < olddb.out no fuss no muss..

Re: [SQL] URGENT!!! changing Column size

2003-10-28 Thread Theodore Petrosky
why not just pg_dump dbname > olddb.out pico olddb.out edit the section that defines the table save and exit dropdb dbname createdb dbname psql dbname < olddb.out no fuss no muss... Ted --- [EMAIL PROTECTED] wrote: > Hi can we change the size of a column in postgres. I > have a table named >

Re: [SQL] Error message during compressed backup

2003-10-28 Thread Kumar
Hi Peter Eisentraut, >>select proowner from pg_proc where proname = 'plpgsql_call_handler'; It gives me an id '101' While I search for the users in the pg_user, there is no user of id 101 select * from pg_user where usesysid = 101; No result was fetched. While I search this way select * from

[SQL] Using % type in Parameters

2003-10-28 Thread Kumar
Dear Friends,   Clarification about the support for the usage of % TYPE in Postgres. I am working with postgres 7.3.4 on RH Linux 7.2. Can I use the %TYPE in parameters as in Oracle.   CREATE OR REPLACE FUNCTION public.fn_listtitle(varchar, varchar)  RETURNS refcursor AS' DECLARE     ref    

[SQL] bug in working with TEXT constants ?

2003-10-28 Thread sad
Good day. AFAIK PostgreSQL provides the type TEXT with 4-byte prefix length which is distinct to C's zero-terminated (char *) That's very good. Then I expect natural possibility to store texts having zero characters. try SELECT 'abc\0de'; SELECT length('abc\0de'); or insert such a value into an