On Wed, Feb 10, 2010 at 11:00:00AM +0900, Takahiro Itagaki wrote:
> Bruce Momjian <br...@momjian.us> wrote:
> 
> > Where are we on this patch?  We should at least implement the completion
> > for 'LANGUAGE' in 'DO', and use the existing pg_language query for
> > completion.  I am attaching a patch that does exactly this.
> 
> I don't think we need the patch except adding DO to the top-level 
> sql_commands.
> 
> Syntax of DO command is:
>     DO code [ LANGUAGE lang_name ]

That's not the only syntax.

    DO [LANGUAGE lang_name] code

also works, e.g.:

CREATE LANGUAGE plperl;
CREATE TABLE foo(id SERIAL PRIMARY KEY, t TEXT);
DO LANGUAGE plperl $$spi_exec_query(q[INSERT INTO foo(t) VALUES('aaa')]);$$;
SELECT * FROM foo;

The DO LANGUAGE lang_name code syntax is much clearer, as far as I'm
concerned, than putting the code block before the language anyhow. :)

Cheers,
David.
-- 
David Fetter <da...@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fet...@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to