Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04c0897

Browse files
committed
psql: Add ignore_slash_options in bind's inactive branch
All commands accepting arguments, handling them with OT_NORMAL, OT_SQLIDor OT_SQLIDHACK, should call ignore_slash_options() in inactive branchto scan and discard extra arguments. All the backslash commands thathandle arguments do so, except \bind.This commit adds the missing ignore_slash_options to \bind's inactivebranch. This inconsistency is a logic bug, however the behavior happensto be unchanged as any extra arguments are discarded later inHandleSlashCmds(), so no backpatch is done.While on it, this adds \bind to the list of backslash commands whereinactive \if branches are checked in the tests for psql.Reported-by: Jelte Fennema-NioAuthor: Anthonin BonnefoyDiscussion:https://postgr.es/m/CAGECzQR1+udGKz+FbHiCQ7CWDiF1fCGi2xYuvQUODdMAfJbaLA@mail.gmail.com
1 parent3ada0d2 commit04c0897

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

‎src/bin/psql/command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ exec_command_bind(PsqlScanState scan_state, bool active_branch)
486486
pset.bind_nparams=nparams;
487487
pset.bind_flag= true;
488488
}
489+
else
490+
ignore_slash_options(scan_state);
489491

490492
returnstatus;
491493
}

‎src/test/regress/expected/psql.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,6 +4506,7 @@ bar 'bar' "bar"
45064506
\echo `nosuchcommand` :foo :'foo' :"foo"
45074507
\pset fieldsep | `nosuchcommand` :foo :'foo' :"foo"
45084508
\a
4509+
SELECT $1 \bind 1 \g
45094510
\C arg1
45104511
\c arg1 arg2 arg3 arg4
45114512
\cd arg1

‎src/test/regress/sql/psql.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ select \if false \\ (bogus \else \\ 42 \endif \\ forty_two;
989989
\echo`nosuchcommand` :foo :'foo' :"foo"
990990
\pset fieldsep |`nosuchcommand` :foo :'foo' :"foo"
991991
\a
992+
SELECT $1 \bind1 \g
992993
\C arg1
993994
\c arg1 arg2 arg3 arg4
994995
\cd arg1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp