Re: PL argument max size, and doubt

From: Martin Marques <martin(at)marquesminen(dot)com(dot)ar>
To: Rodrigo De León <rdeleonp(at)gmail(dot)com>
Cc: PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: PL argument max size, and doubt
Date: 2007-11-21 17:46:59
Message-ID: 47446F13.3090003@marquesminen.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rodrigo De León escribió:
> On Nov 21, 2007 8:23 AM, Martin Marques <martin(at)marquesminen(dot)com(dot)ar> 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-11-21 18:05:26 Re: PL argument max size, and doubt
Previous Message Rodrigo De León 2007-11-21 15:29:15 Re: PL argument max size, and doubt