pgsql: Add psql tab completion for DO blocks.

Started by Nonamealmost 16 years ago3 messages
#1Noname
itagaki@postgresql.org

Log Message:
-----------
Add psql tab completion for DO blocks.
Also adjust documentation of DO.

Patch from David Fetter and subsequent discussion.

Modified Files:
--------------
pgsql/doc/src/sgml/ref:
do.sgml (r1.3 -> r1.4)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/do.sgml?r1=1.3&r2=1.4)
pgsql/src/bin/psql:
tab-complete.c (r1.192 -> r1.193)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/tab-complete.c?r1=1.192&r2=1.193)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: pgsql: Add psql tab completion for DO blocks.

itagaki@postgresql.org (Takahiro Itagaki) writes:

Add psql tab completion for DO blocks.
Also adjust documentation of DO.

This syntax synopsis is completely nuts:

DO { [ LANGUAGE <replaceable class="PARAMETER">lang_name</replaceable> ] | <replaceable class="PARAMETER">code</replaceable> } ...

It implies that an empty string is a valid substitute for the { ... }
construct, since I could take the first choice and then omit the
optional bracketed construct.

I think that it would be logically correct without the square brackets,
but as a matter of clarity I really doubt it's an improvement over the
original.

regards, tom lane

#3Takahiro Itagaki
itagaki.takahiro@oss.ntt.co.jp
In reply to: Tom Lane (#2)
Re: [COMMITTERS] pgsql: Add psql tab completion for DO blocks.

Tom Lane <tgl@sss.pgh.pa.us> wrote:

itagaki@postgresql.org (Takahiro Itagaki) writes:
This syntax synopsis is completely nuts:
DO { [ LANGUAGE lang_name ] | code } ...

I think that it would be logically correct without the square brackets,

Oops, that's correct.

but as a matter of clarity I really doubt it's an improvement over the
original.

We cannot write down the accurate syntax with BNF, right? We can have
0..1 "LANGUAGE lang_name", but must have just 1 "code" in any order.

How about the following description?

DO [ LANGUAGE lang_name ] code

because the psql tab completion adds LANGUAGE just after DO.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center