FAQ
Whenever I use copy-paste to run code in a terminal window that is
running psql, and the code contains a row like

IF FOUND THEN

then I get the words

ABORT CHECKPOINT COMMIT DECLARE EXECUTE
INSERT MOVE REINDEX ROLLBACK SHOW
UPDATE
ALTER CLOSE COPY DELETE FROM EXPLAIN
LISTEN NOTIFY RELEASE SAVEPOINT START
VACUUM
ANALYZE CLUSTER CREATE DROP FETCH LOAD
PREPARE RESET SELECT TRUNCATE
BEGIN COMMENT DEALLOCATE END GRANT LOCK
REASSIGN REVOKE SET UNLISTEN

That must be some kind of display of possible stuff to write after
"THEN" but it is very annoying. How to turn it of?

Search Discussions

  • Sam Mason at May 27, 2008 at 2:07 pm

    On Tue, May 27, 2008 at 03:24:38PM +0200, A B wrote:
    Whenever I use copy-paste to run code in a terminal window that is
    running psql, and the code contains a row like

    IF FOUND THEN

    then I get the words [...]
    That must be some kind of display of possible stuff to write after
    "THEN" but it is very annoying. How to turn it of?
    I'd guess the next line of code starts with a tab character and hence
    psql is just tab completing the (empty) line. If you don't want this to
    happen, you can disable table completion. From the man page:

    If
    for some reason you do not like the tab completion, you can turn it off
    by putting this in a file named .inputrc in your home directory:

    $if psql
    set disable-completion on
    $endif

    As an aside, there isn't an "if" statement in SQL.


    Sam
  • Tom Lane at May 27, 2008 at 2:29 pm

    "A B" <gentosaker@gmail.com> writes:
    Whenever I use copy-paste to run code in a terminal window that is
    running psql, and the code contains a row like
    IF FOUND THEN
    then I get the words
    ABORT CHECKPOINT COMMIT DECLARE EXECUTE
    ...
    Either avoid copying/pasting tabs, or turn off readline
    (-n option to psql, I think, but check the manual).

    There's probably a way to turn off tab-completion without
    disabling readline altogether, but I don't know how offhand.

    regards, tom lane
  • Alvaro Herrera at Jun 5, 2008 at 9:50 pm

    Tom Lane escribió:
    "A B" <gentosaker@gmail.com> writes:
    Whenever I use copy-paste to run code in a terminal window that is
    running psql, and the code contains a row like
    [...]
    Either avoid copying/pasting tabs, or turn off readline
    (-n option to psql, I think, but check the manual).

    There's probably a way to turn off tab-completion without
    disabling readline altogether, but I don't know how offhand.
    This can be done by adding

    $if psql
    set disable-completion on
    $endif

    to .inputrc.

    --
    Alvaro Herrera http://www.CommandPrompt.com/
    The PostgreSQL Company - Command Prompt, Inc.
  • Merlin Moncure at Jun 6, 2008 at 2:28 am

    On Tue, May 27, 2008 at 9:24 AM, A B wrote:
    Whenever I use copy-paste to run code in a terminal window that is
    running psql, and the code contains a row like

    IF FOUND THEN

    then I get the words

    ABORT CHECKPOINT COMMIT DECLARE EXECUTE
    [...]

    As others have noted, you have tabs in your sql source. I'd advise if
    possible, not to use the tab character in sql, for this and other
    reasons.

    merlin
  • Gurjeet Singh at Jun 6, 2008 at 4:39 am

    On Fri, Jun 6, 2008 at 7:58 AM, Merlin Moncure wrote:
    On Tue, May 27, 2008 at 9:24 AM, A B wrote:
    Whenever I use copy-paste to run code in a terminal window that is
    running psql, and the code contains a row like

    IF FOUND THEN

    then I get the words

    ABORT CHECKPOINT COMMIT DECLARE EXECUTE
    [...]

    As others have noted, you have tabs in your sql source. I'd advise if
    possible, not to use the tab character in sql, for this and other
    reasons.

    Can you please elaborate on other reasons? I have never encountered any
    _other_ reason!!

    And 'using psql' is not reason enough to not indent your SQL code.

    Best regards,
    --
    gurjeet[.singh]@EnterpriseDB.com
    singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

    EnterpriseDB http://www.enterprisedb.com

    Mail sent from my BlackLaptop device
  • Merlin Moncure at Jun 6, 2008 at 12:14 pm

    On Fri, Jun 6, 2008 at 12:39 AM, Gurjeet Singh wrote:
    On Fri, Jun 6, 2008 at 7:58 AM, Merlin Moncure wrote:
    As others have noted, you have tabs in your sql source. I'd advise if
    possible, not to use the tab character in sql, for this and other
    reasons.
    Can you please elaborate on other reasons? I have never encountered any
    _other_ reason!!

    And 'using psql' is not reason enough to not indent your SQL code.
    For example, another reason tabs are annoying are how your function
    sources show up in '\df+' (escaped). iirc you can get around this
    with '\x', but why bother with that? Also, I am not suggesting not to
    indent your sql, just not to use the tab character.

    merlin
  • Scott Marlowe at Jun 6, 2008 at 5:05 pm

    On Fri, Jun 6, 2008 at 6:12 AM, Merlin Moncure wrote:
    On Fri, Jun 6, 2008 at 12:39 AM, Gurjeet Singh wrote:
    On Fri, Jun 6, 2008 at 7:58 AM, Merlin Moncure wrote:
    As others have noted, you have tabs in your sql source. I'd advise if
    possible, not to use the tab character in sql, for this and other
    reasons.
    Can you please elaborate on other reasons? I have never encountered any
    _other_ reason!!

    And 'using psql' is not reason enough to not indent your SQL code.
    For example, another reason tabs are annoying are how your function
    sources show up in '\df+' (escaped). iirc you can get around this
    with '\x', but why bother with that? Also, I am not suggesting not to
    indent your sql, just not to use the tab character.
    Almost every decent text editor has the option to use spaces in place
    of tabs. Even Nano can do it.
  • Reece Hart at Jun 6, 2008 at 5:14 pm

    On Thu, 2008-06-05 at 22:28 -0400, Merlin Moncure wrote:

    As others have noted, you have tabs in your sql source. I'd advise if
    possible, not to use the tab character in sql, for this and other
    reasons.

    Tabs in SQL are a problem only if you copy-paste. If your editor and
    psql can see the same files (i.e., are running on the same machine or
    you're saving to a network fs), it's more reliable to save the file and
    read it in psql with \i or with psql -f. (\i and -f won't try to do tab
    completion, of course.)

    -Reece

    --
    Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedMay 27, '08 at 1:24p
activeJun 6, '08 at 5:14p
posts9
users8
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase