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

Commited7e686

Browse files
committed
psql: Tweak xheader_width and pager_min_lines input parsing
Don't throw away the previous value when an invalid value is proposed.Discussion:https://postgr.es/m/20230519110205.updpbjiuqgbox6gp@alvherre.pgsql
1 parent8e7912e commited7e686

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/bin/psql/command.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,13 +4521,16 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
45214521
popt->topt.expanded_header_width_type=PRINT_XHEADER_PAGE;
45224522
else
45234523
{
4524-
popt->topt.expanded_header_width_type=PRINT_XHEADER_EXACT_WIDTH;
4525-
popt->topt.expanded_header_exact_width=atoi(value);
4526-
if (popt->topt.expanded_header_exact_width==0)
4524+
intintval=atoi(value);
4525+
4526+
if (intval==0)
45274527
{
45284528
pg_log_error("\\pset: allowed xheader_width values are \"%s\" (default), \"%s\", \"%s\", or a number specifying the exact width","full","column","page");
45294529
return false;
45304530
}
4531+
4532+
popt->topt.expanded_header_width_type=PRINT_XHEADER_EXACT_WIDTH;
4533+
popt->topt.expanded_header_exact_width=intval;
45314534
}
45324535
}
45334536

@@ -4660,8 +4663,9 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
46604663
/* set minimum lines for pager use */
46614664
elseif (strcmp(param,"pager_min_lines")==0)
46624665
{
4663-
if (value)
4664-
popt->topt.pager_min_lines=atoi(value);
4666+
if (value&&
4667+
!ParseVariableNum(value,"pager_min_lines",&popt->topt.pager_min_lines))
4668+
return false;
46654669
}
46664670

46674671
/* disable "(x rows)" footer */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp