Re: PL argument max size, and doubt - Mailing list pgsql-sql

From Rodrigo De León
Subject Re: PL argument max size, and doubt
Date
Msg-id a55915760711210729t7d255de2kf0abc309ffd84ccc@mail.gmail.com
Whole thread Raw
In response to PL argument max size, and doubt  (Martin Marques <martin@marquesminen.com.ar>)
Responses Re: PL argument max size, and doubt  (Martin Marques <martin@marquesminen.com.ar>)
List pgsql-sql
On Nov 21, 2007 8:23 AM, Martin Marques <martin@marquesminen.com.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

> 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';


pgsql-sql by date:

Previous
From: Martin Marques
Date:
Subject: PL argument max size, and doubt
Next
From: Martin Marques
Date:
Subject: Re: PL argument max size, and doubt