Skip site navigation (1) Skip section navigation (2)

Re: Anonymous code blocks

From: Petr Jelinek <pjmodos(at)pjmodos(dot)net>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: Anonymous code blocks
Date: 2009-09-22 13:01:58
Message-ID: 4AB8CAC6.2070705@pjmodos.net (view raw or flat)
Thread:
Lists: pgsql-hackers
Dimitri Fontaine napsal(a):
> Hi,
>
> Dimitri Fontaine <dfontaine(at)hi-media(dot)com> writes:
>   
>> Patch applies cleanly and build cleanly too, basic examples are working
>> fine. 
>>     
>
> I've been reading through the code and am going to mark it as ready for
> commiter, as only remarks I have are probably because I do not know
> enough about PostgreSQL internals, and the one I missed are in the same
> category. 
>
> The patch is easy to read and all it does looks straightforward, even
> for me :)
>
> Here we go:
>
> *** a/src/backend/tcop/utility.c
> --- b/src/backend/tcop/utility.c
> ...
> *************** UtilityReturnsTuples(Node *parsetree)
> *** 1147,1155 ****
> ...
> - 		case T_ExplainStmt:
> - 			return true;
> - 
>
> Is this not a oversight in the final patch?
>   

It is. I attached patch which does not have this part.

>
> + 	/* This is short-lived, so needn't allocate in function's cxt */
> + 	plpgsql_Datums = palloc(sizeof(PLpgSQL_datum *) * datums_alloc);
> ...
> + 	compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
>
> I wonder why not having the datums into the func_cxt too.
>   

Actually I think we might not need that function memory context for 
anonymous code blocks at all since we don't cache compiled functions. 
But I am not sure so I basically copied it from standard function 
compiler to be on safe side. I am sure commiter will comment on this :)

-- 
Regards
Petr Jelinek (PJMODOS)


Attachment: inlinepl-2009-09-22.diff.gz
Description: application/x-tar (9.0 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2009-09-22 13:29:13
Subject: Re: Hot Standby 0.2.1
Previous:From: Euler Taveira de OliveiraDate: 2009-09-22 12:51:57
Subject: Re: numeric_to_number() function skipping some digits

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group