pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin@marquesminen.com.ar>
To: Rodrigo De León <rdeleonp@gmail.com>
Cc: PostgreSQL SQL List <pgsql-sql@postgresql.org>
Subject: Re: PL argument max size, and doubt
Date: Wed, 21 Nov 2007 14:46:59 -0300
Message-ID: <47446F13.3090003@marquesminen.com.ar> (raw)
In-Reply-To: <a55915760711210729t7d255de2kf0abc309ffd84ccc@mail.gmail.com>
References: <4744313C.40107@marquesminen.com.ar>
	<a55915760711210729t7d255de2kf0abc309ffd84ccc@mail.gmail.com>

Rodrigo De León escribió:
> 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
>   
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.




view thread (7+ messages)  latest in thread

Message-ID: <47446F13.3090003@marquesminen.com.ar>
Permalink:  ../47446F13.3090003@marquesminen.com.ar/
Also on:    postgresql.org/message-id/47446F13.3090003@marquesminen.com.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin@marquesminen.com.ar, rdeleonp@gmail.com
  Subject: Re: PL argument max size, and doubt
  In-Reply-To: <47446F13.3090003@marquesminen.com.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox