Anonymous code blocks (was: Re: GRANT ON ALL IN schema) - Mailing list pgsql-hackers

From Petr Jelinek
Subject Anonymous code blocks (was: Re: GRANT ON ALL IN schema)
Date
Msg-id 4A986AA6.7030505@pjmodos.net
Whole thread Raw
In response to Re: GRANT ON ALL IN schema  (Petr Jelinek <pjmodos@pjmodos.net>)
Responses Re: Anonymous code blocks (was: Re: GRANT ON ALL IN schema)  (Brendan Jurd <direvus@gmail.com>)
Re: Anonymous code blocks  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-hackers
> The question is still valid, though it's better put in your words - do
> we want to refactor the existing compiler or write a separate one ?

So, for now I went with the path of custom compiler and current executor.

I attached current version of the patch. I don't expect this to get
committed or anything, but I'd like other eyes to take a look at it.

What it does:
Adds laninline Oid which points to function handling inline code (aka
anonymous code block).
Adds DO $$some code$$ [ LANGUAGE lanname ] syntax which sends the source
code to that laninline function of the specified language (or language
set by default_do_language guc).
There is implementation for plpgsql with simpler compiler which still
creates function struct for the executor (I believe there is no harm in
adjusting executor later, when current one works, just does unnecessary
stuff).
There is doc and a simple regression test for plpgsql implementation.


--
Regards
Petr Jelinek (PJMODOS)


Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Linux LSB init script
Next
From: Ron Mayer
Date:
Subject: Re: Add YAML option to explain