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

Commita7eece4

Browse files
committed
Fix breakage of "\pset format latex".
Commiteaf746a unintentionally made psql's "latex" output formatinaccessible, since not only "latex" but all abbreviations of itwere considered ambiguous against "latex-longtable". Let's goback to the longstanding behavior that all shortened versionsmean "latex", and you have to write at least "latex-" to get"latex-longtable". This leaves the only difference from pre-v12behavior being that "\pset format a" is considered ambiguous.The fact that the regression tests didn't expose this is pretty bad,but fixing it is material for a separate commit.Discussion:https://postgr.es/m/cb7e1caf-3ea6-450d-af28-f524903a030c@manitou-mail.org
1 parent36d442a commita7eece4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/bin/psql/command.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,6 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
36983698
{"asciidoc",PRINT_ASCIIDOC},
36993699
{"html",PRINT_HTML},
37003700
{"latex",PRINT_LATEX},
3701-
{"latex-longtable",PRINT_LATEX_LONGTABLE},
37023701
{"troff-ms",PRINT_TROFF_MS},
37033702
{"unaligned",PRINT_UNALIGNED},
37043703
{"wrapped",PRINT_WRAPPED}
@@ -3725,13 +3724,22 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
37253724
}
37263725
}
37273726
}
3728-
if (match_pos<0)
3727+
if (match_pos >=0)
3728+
popt->topt.format=formats[match_pos].number;
3729+
elseif (pg_strncasecmp("latex-longtable",value,vallen)==0)
3730+
{
3731+
/*
3732+
* We must treat latex-longtable specially because latex is a
3733+
* prefix of it; if both were in the table above, we'd think
3734+
* "latex" is ambiguous.
3735+
*/
3736+
popt->topt.format=PRINT_LATEX_LONGTABLE;
3737+
}
3738+
else
37293739
{
37303740
psql_error("\\pset: allowed formats are aligned, asciidoc, html, latex, latex-longtable, troff-ms, unaligned, wrapped\n");
37313741
return false;
37323742
}
3733-
else
3734-
popt->topt.format=formats[match_pos].number;
37353743
}
37363744
}
37373745

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp