Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9498C2E0035 for ; Wed, 21 Nov 2007 13:47:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 40361-01 for ; Wed, 21 Nov 2007 13:47:12 -0400 (AST) Received: from smtp-04.arnet.com.ar (smtp-04.arnet.com.ar [200.45.191.26]) by postgresql.org (Postfix) with SMTP id 8BA912E0032 for ; Wed, 21 Nov 2007 13:47:12 -0400 (AST) Received: (qmail 29614 invoked from network); 21 Nov 2007 17:47:01 -0000 Received: from unknown (HELO mail.marquesminen.com.ar) (190.31.63.34) by 0 with SMTP; 21 Nov 2007 17:47:01 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.marquesminen.com.ar (Postfix) with ESMTP id A311C284FE; Wed, 21 Nov 2007 14:47:04 -0300 (ART) X-Virus-Scanned: amavisd-new at example.com Received: from mail.marquesminen.com.ar ([127.0.0.1]) by localhost (linus.marques [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vYm5cN0ymjID; Wed, 21 Nov 2007 14:47:00 -0300 (ART) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by mail.marquesminen.com.ar (Postfix) with ESMTP id 94F75282D0; Wed, 21 Nov 2007 14:47:00 -0300 (ART) Message-ID: <47446F13.3090003@marquesminen.com.ar> Date: Wed, 21 Nov 2007 14:46:59 -0300 From: Martin Marques User-Agent: Thunderbird 1.5.0.12 (X11/20071019) MIME-Version: 1.0 To: =?UTF-8?B?Um9kcmlnbyBEZSBMZcOzbg==?= CC: PostgreSQL SQL List Subject: Re: PL argument max size, and doubt References: <4744313C.40107@marquesminen.com.ar> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/103 X-Sequence-Number: 29631 Rodrigo De León escribió: > On Nov 21, 2007 8:23 AM, Martin Marques wrote: > >> (BTW, which it that limit if it exists?). >> > > "In any case, the longest possible character string that can be stored > is about 1 GB." > > See: > http://www.postgresql.org/docs/8.2/static/datatype-character.html > I was asking about the limit in the argument. Is it the same as the limits the types have in table definition? >> So I made the function to test: >> >> CREATE OR REPLACE FUNCTION datoGrande(TEXT) RETURNS BOOLEAN AS $body$ >> BEGIN >> EXECUTE $ins1$ >> INSERT INTO funcdatogrande VALUES (default,$ins1$ || >> quote_literal($1) || $ins2$)$ins2$; >> IF FOUND THEN >> RETURN TRUE; >> ELSE >> RETURN FALSE; >> END IF; >> END; >> $body$ LANGUAGE 'plpgsql'; >> >> >> What bothers me is that the INSERT passes ok (the data is inserted) but >> the function is returning false on any all to it. I hope not to have a >> conceptual problem. >> > > I don't think EXECUTEing sets FOUND to true. Try: > > CREATE OR REPLACE FUNCTION > DATOGRANDE(TEXT) > RETURNS BOOLEAN AS $$ > BEGIN > INSERT INTO FUNCDATOGRANDE VALUES (DEFAULT,$1); > IF FOUND THEN > RETURN TRUE; > ELSE > RETURN FALSE; > END IF; > END; > $$ LANGUAGE 'PLPGSQL'; > I have always heard that modification queries should be EXECUTED in PL. AFAICR.