Re: Two successive tabs in test case are causing syntax error in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Two successive tabs in test case are causing syntax error in psql
Date: 2022-07-08 19:35:26
Message-ID: 3480314.1657308926@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jingtang Zhang <mrdrivingduck(at)gmail(dot)com> writes:
> Recently, when I was developing some function about INSERT ... ON CONFLICT,
> I used test cases in `src/test/regress/sql/insert_conflict.sql` to evaluate
> my function. When I copy the CREATE TABLE from this case alone, and paste
> it to psql, I got a syntax error. As I go through the case carefully, I
> found the CREATE TABLE uses two tabs to separate column name and column
> type, and this two tabs are regarded as an auto completion instruction by
> psql, causing no separation between column name and column type anymore.

> It may not be a problem since this case has passed the regression, but
> would it be better to use space here to avoid this confusing situation?

There are tabs all through the regression test files, and we're certainly
not going to remove them all. (If we did, we'd lose test coverage of
whether the parser accepts tabs as whitespace.) So I can't get excited
about removing one or two.

The usual recommendation for pasting text into psql when it contains
tabs is to start psql with the -n switch to disable tab completion.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2022-07-08 19:48:06 Re: Aggregate leads to superfluous projection from the scan
Previous Message David Zhang 2022-07-08 19:35:22 Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths