On Fri, Oct 28, 2011 at 11:07:25AM -0400, Gurjeet Singh wrote:
> On Fri, Oct 28, 2011 at 10:11 AM, Bruce Momjian <br...@momjian.us> wrote:
> 
>     Gurjeet Singh wrote:
>     > > > I have tried reproducing the bug starting from 1 and 2 transactions
>     > > before
>     > > > the one shown in snippet, and I used tab-completion to get the same
>     > > > screen-output as termonal1.txt and yet it's not reproducible.
>     > >
>     > > I could reproduce it when I typed TAB just after typing "set" in "set
>     > > transaction snapshot".
>     > > As Tom and Alvaro pointed out, the tab-completion issues a query and
>     which
>     > > prevents the "set transaction snapshot" command.
>     > >
>     >
>     > Great! That settles it then. Reproducible, but not a bug.
> 
>     Yes, it is only tabs that query the database for completion that cause
>     this.  Should this be documented somehow?  (No idea how.)
> 
> 
> If we have a doc section on psql's tab-completion, I think this needs to go
> there. A note like:
> 
> "Trying to tab-complete on psql may send queries to the server, and depending
> on the transaction state, execution of these queries may lead to non-default/
> unexpected behaviour by the queries executed after tab-completion. For 
> example,
> ..."

I have added the attached patch to document this limitation.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
new file mode 100644
index ebb0ad4..a47af51
*** a/doc/src/sgml/ref/psql-ref.sgml
--- b/doc/src/sgml/ref/psql-ref.sgml
*************** testdb=&gt; \set PROMPT1 '%[%033[1;33;40
*** 3272,3278 ****
      exits and is reloaded when
      <application>psql</application> starts up. Tab-completion is also
      supported, although the completion logic makes no claim to be an
!     <acronym>SQL</acronym> parser.  If for some reason you do not like the tab completion, you
      can turn it off by putting this in a file named
      <filename>.inputrc</filename> in your home directory:
  <programlisting>
--- 3272,3281 ----
      exits and is reloaded when
      <application>psql</application> starts up. Tab-completion is also
      supported, although the completion logic makes no claim to be an
!     <acronym>SQL</acronym> parser.  The queries generated by tab-completion
!     can also interfere with other SQL commands, e.g. <literal>SET
!     TRANSACTION ISOLATION LEVEL</>.
!     If for some reason you do not like the tab completion, you
      can turn it off by putting this in a file named
      <filename>.inputrc</filename> in your home directory:
  <programlisting>
-- 
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