pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Jelinek <pjmodos@pjmodos.net>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Subject: Anonymous code blocks (was: Re: GRANT ON ALL IN schema)
Date: Sat, 29 Aug 2009 01:39:18 +0200
Message-ID: <4A986AA6.7030505@pjmodos.net> (raw)
In-Reply-To: <4A8F24D4.9040801@pjmodos.net>
References: <4A86B5D5.6060807@dunslane.net>
	<4A871F46.1040002@agliodbs.com>
	<5D5ECAE0-F2B0-479B-9594-50AAF18F10ED@hi-media.com>
	<20090815223102.GS5407@samason.me.uk>
	<1250378139.18992.6.camel@vanquo.pezone.net>
	<603c8f070908152051mbd1d706hb0e29f5cfaf2f151@mail.gmail.com>
	<4A87854B.3070707@dunslane.net>
	<1250427428.26280.2.camel@vanquo.pezone.net>
	<395.1250439160@sss.pgh.pa.us>
	<4A8D9CA0.1040607@pjmodos.net>
	<20090820190604.GK6261@alvh.no-ip.org>
	<3493.1250864810@sss.pgh.pa.us>
	<4A8F1986.3030506@pjmodos.net>
	<11481.1250892674@sss.pgh.pa.us>
	<4A8F24D4.9040801@pjmodos.net>

> 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)

Attachments:

  [application/x-tar] inlinepl-2009-08-28.diff.gz (9.0K, ../4A986AA6.7030505@pjmodos.net/2-inlinepl-2009-08-28.diff.gz)
  download

view thread (3+ messages)  latest in thread

Message-ID: <4A986AA6.7030505@pjmodos.net>
Permalink:  ../4A986AA6.7030505@pjmodos.net/
Also on:    postgresql.org/message-id/4A986AA6.7030505@pjmodos.net

 · 

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-hackers@postgresql.org
  Cc: pjmodos@pjmodos.net, tgl@sss.pgh.pa.us, alvherre@commandprompt.com
  Subject: Re: Anonymous code blocks (was: Re: GRANT ON ALL IN schema)
  In-Reply-To: <4A986AA6.7030505@pjmodos.net>

* 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