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

Commit984e5be

Browse files
committed
Sort out paired double quotes in \connect, \password and \crosstabview.
In arguments, these meta-commands wrongly treated each pair as closingthe double quoted string. Make the behavior match the documentation.This is a compatibility break, but I more expect to find software withuntested reliance on the documented behavior than software reliant ontoday's behavior. Back-patch to 9.1 (all supported versions).Reviewed by Tom Lane and Peter Eisentraut.Security:CVE-2016-5424
1 parenta1f8b6b commit984e5be

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

‎src/bin/psql/psqlscanslash.l

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ dequote_downcase_identifier(char *str, bool downcase, int encoding)
671671
/* Keep the first quote, remove the second */
672672
cp++;
673673
}
674-
inquotes = !inquotes;
674+
else
675+
inquotes = !inquotes;
675676
/* Collapse out quote at *cp */
676677
memmove(cp, cp +1,strlen(cp));
677678
/* do not advance cp */

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ SELECT v, to_char(d, 'Mon') AS "month name", EXTRACT(month FROM d) AS num,
4646
(3 rows)
4747

4848
-- ordered months in vertical header, ordered years in horizontal header
49-
SELECT EXTRACT(year FROM d) AS year, to_char(d,'Mon') AS "month name",
49+
SELECT EXTRACT(year FROM d) AS year, to_char(d,'Mon') AS """month"" name",
5050
EXTRACT(month FROM d) AS month,
5151
format('sum=%s avg=%s', sum(i), avg(i)::numeric(2,1))
5252
FROM ctv_data
5353
GROUP BY EXTRACT(year FROM d), to_char(d,'Mon'), EXTRACT(month FROM d)
5454
ORDER BY month
55-
\crosstabview "month name" year format year
56-
month name | 2014 | 2015
57-
------------+-----------------+----------------
58-
Jan | | sum=3 avg=3.0
59-
Apr | | sum=10 avg=5.0
60-
Jul | sum=5 avg=5.0 | sum=4 avg=4.0
61-
Dec | sum=-3 avg=-3.0 |
55+
\crosstabview """month"" name" year format year
56+
"month" name | 2014 | 2015
57+
--------------+-----------------+----------------
58+
Jan| | sum=3 avg=3.0
59+
Apr| | sum=10 avg=5.0
60+
Jul| sum=5 avg=5.0 | sum=4 avg=4.0
61+
Dec| sum=-3 avg=-3.0 |
6262
(4 rows)
6363

6464
-- combine contents vertically into the same cell (V/H duplicates)

‎src/test/regress/sql/psql_crosstab.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ SELECT v, to_char(d, 'Mon') AS "month name", EXTRACT(month FROM d) AS num,
2929
\crosstabview v"month name"4 num
3030

3131
-- ordered months in vertical header, ordered years in horizontal header
32-
SELECT EXTRACT(yearFROM d)AS year, to_char(d,'Mon')AS"month name",
32+
SELECT EXTRACT(yearFROM d)AS year, to_char(d,'Mon')AS"""month"" name",
3333
EXTRACT(monthFROM d)AS month,
3434
format('sum=%s avg=%s',sum(i),avg(i)::numeric(2,1))
3535
FROM ctv_data
3636
GROUP BY EXTRACT(yearFROM d), to_char(d,'Mon'), EXTRACT(monthFROM d)
3737
ORDER BY month
38-
\crosstabview"month name" year format year
38+
\crosstabview"""month"" name" year format year
3939

4040
-- combine contents vertically into the same cell (V/H duplicates)
4141
SELECT v, h, string_agg(c, E'\n')FROM ctv_dataGROUP BY v, hORDER BY1,2,3

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp