Two successive tabs in test case are causing syntax error in psql
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46209psql -h localhost -U postgresBuilt from patchset v1 (message #1), September 20, 2026 at 05:48 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t46209_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t46209_1 && git checkout t46209_1Patchset v1 (message #1) is on t46209_1
Hi, community.
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?
Since other part of this case are all using spaces.
Never mind my opinion as a beginner, thanks.
Jingtang Zhang
Jingtang Zhang <mrdrivingduck@gmail.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
I see, thank you.
Tom Lane <tgl@sss.pgh.pa.us> 于2022年7月9日周六 03:35写道:
Show quoted text
Jingtang Zhang <mrdrivingduck@gmail.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
On 2022-Jul-08, Tom Lane wrote:
The usual recommendation for pasting text into psql when it contains
tabs is to start psql with the -n switch to disable tab completion.
"Bracketed paste" also solves this problem. To enable this feature,
just edit your $HOME/.inputrc file to have the line
set enable-bracketed-paste on
(then restart psql) which will cause the text passed to be used
literally, so the tabs won't invoke tab-completion. There are other
side-effects: if you paste a multi-command string, the whole string is
added as a single entry in the history rather than being separate
entries. I find this extremely useful; there are also claims of this
being more secure.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/