Re: [SQL] Conver bool to text

2005-03-11 Thread Marco Manfredini
Edmund Bacon wrote: > Is there a way to convert a boolean value to text and/or vice versa? > [cause it doesn't work as expected] > > It's not that difficult to write a fuction to convert boolean to text, > but I'm wondering if there's already something that does this? You can help y

[SQL] Conver bool to text

2005-03-11 Thread Edmund Bacon
Is there a way to convert a boolean value to text and/or vice versa? You can select 'true'::boolean, which *seems* to convert a text string to boolean, but select 'true'::text::boolean earns the message ERROR: cannot cast type text to boolean You can't go the other way either SELECT true::text

Re: [SQL] [GENERAL] more execution time

2005-03-11 Thread Richard Huxton
ALÝ ÇELÝK wrote: why this query needs more time? Its very slow Difficult to say for sure - could you provide the output of EXPLAIN ANALYSE rather than just EXPLAIN? Some other immediate observations: 1. Perhaps don't post to so many mailing lists at once. If you reply to this, maybe reduce it t

Re: [SQL] pl/pgsql problem with return types

2005-03-11 Thread Juris Zeltins
Yep.. i have solved this problem by specifying the correct return type and variable type (should be the same) but as said, in some cases pl_exec executes with type conversion. as real example - i have : return type = SETOF new type "category_node(catid, pcatid)" variable = R, SR -> RECORD and FOR

Re: [SQL] pl/pgsql problem with return types

2005-03-11 Thread John DeSoi
On Mar 11, 2005, at 5:54 AM, Juris Zeltins wrote: FOR P IN select pageid from pages This way you are only getting the pageid column. I think what you want is FOR P in select * from pages so that P contains the complete pages record. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreS

[SQL] more execution time

2005-03-11 Thread AL� �EL�K
why this query needs more time? Its very slow thx //QUERY select coalesce(personaldetails.masterid::numeric,personaldetails.id) + (coalesce(personaldetails.id::numeric,0)/100) as sorting, floor(coalesce(personaldetails.masterid::numeric,personaldet

[SQL] pl/pgsql problem with return types

2005-03-11 Thread Juris Zeltins
Hello! i have problem with pl/pgsql function; === ERROR: wrong record type supplied in RETURN NEXT CONTEXT: PL/pgSQL function "tests" line 6 at return next === -- Function: tests(int8) -- DROP FUNCTION tests(int8); CREATE OR REPLACE FUNCTION te