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

Re: psql tab completion for DO blocks

From: David Fetter <david(at)fetter(dot)org>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>,PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql tab completion for DO blocks
Date: 2010-02-11 20:27:41
Message-ID: 20100211202741.GC11972@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Feb 10, 2010 at 11:00:00AM +0900, Takahiro Itagaki wrote:
> Bruce Momjian <bruce(at)momjian(dot)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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-02-11 20:32:32
Subject: Re: Re: [COMMITTERS] pgsql: Remove old-style VACUUM FULL (which was known for a little while
Previous:From: Tom LaneDate: 2010-02-11 20:26:53
Subject: Re: review: More frame options in window functions

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