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

Commitbd406af

Browse files
committed
psql: Improve \crosstabview error messages
1 parent562e449 commitbd406af

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎src/bin/psql/crosstabview.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ PrintResultsInCrosstab(const PGresult *res)
122122

123123
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
124124
{
125-
psql_error("\\crosstabview:query mustreturnresults to be shown in crosstab\n");
125+
psql_error("\\crosstabview:statement did notreturna result set\n");
126126
gotoerror_return;
127127
}
128128

@@ -643,7 +643,8 @@ indexOfColumn(char *arg, const PGresult *res)
643643
idx=atoi(arg)-1;
644644
if (idx<0||idx >=PQnfields(res))
645645
{
646-
psql_error("\\crosstabview: invalid column number: \"%s\"\n",arg);
646+
psql_error("\\crosstabview: column number %d is out of range 1..%d\n",
647+
idx+1,PQnfields(res));
647648
return-1;
648649
}
649650
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ SELECT 1 as "22", 2 as b, 3 as "Foo"
188188
-- error: bad column number
189189
SELECT v,h,i,c FROM ctv_data
190190
\crosstabview 2 1 5
191-
\crosstabview:invalidcolumn number: "5"
191+
\crosstabview: column number 5 is out of range 1..4
192192
-- error: same H and V columns
193193
SELECT v,h,i,c FROM ctv_data
194194
\crosstabview 2 h 4

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp