Skip to content

Commit d9d8169

Browse files
committed
Fix for length in libpq from Tom Lane.
1 parent 3a9c626 commit d9d8169

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/interfaces/libpq/fe-exec.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.67 1998/09/04 05:03:02 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.68 1998/09/10 15:18:02 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -541,6 +541,16 @@ getRowDescriptions(PGconn *conn)
541541
PQclear(result);
542542
return EOF;
543543
}
544+
/*
545+
* Since pqGetInt treats 2-byte integers as unsigned, we need to
546+
* coerce the special value "-1" to signed form. (-1 is sent for
547+
* variable-length fields.) Formerly, libpq effectively did a
548+
* sign-extension on the 2-byte value by storing it in a signed short.
549+
* Now we only coerce the single value 65535 == -1; values
550+
* 32768..65534 are taken as valid field lengths.
551+
*/
552+
if (typlen == 0xFFFF)
553+
typlen = -1;
544554
result->attDescs[i].name = strdup(typName);
545555
result->attDescs[i].typid = typid;
546556
result->attDescs[i].typlen = typlen;
@@ -1488,7 +1498,7 @@ PQoidStatus(PGresult *res)
14881498
if (strncmp(res->cmdStatus, "INSERT ", 7) != 0)
14891499
return "";
14901500

1491-
/*
1501+
/*----------
14921502
* The cmdStatus string looks like
14931503
* INSERT oid count\0
14941504
* In order to be able to return an ordinary C string without
@@ -1498,6 +1508,7 @@ PQoidStatus(PGresult *res)
14981508
* INSERT oid count\0oid\0
14991509
* ^ our return value points here
15001510
* Pretty klugy eh? This routine should've just returned an Oid value.
1511+
*----------
15011512
*/
15021513

15031514
slen = strlen(res->cmdStatus);

src/tools/backend/flow.fig

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
#FIG 3.1
1+
#FIG 3.2
22
Landscape
33
Center
44
Inches
5+
Letter
6+
100.00
7+
Single
8+
-2
59
1200 2
610
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
711
0 0 2.00 150.00 180.00
@@ -95,16 +99,16 @@ Inches
9599
0 0 2.00 150.00 150.00
96100
1350 9375 1050 9375 825 9000 825 4425 1050 4050 1500 3975
97101
2250 3975 2400 4275
102+
0.000 1.000 1.000 1.000 1.000 1.000 1.000 0.000
98103
3 0 0 2 8 7 0 0 -1 0.000 0 1 0 7
99104
0 0 2.00 150.00 150.00
100105
7650 5775 8250 5475 8250 4575 7725 3975 3525 3975 2850 3975
101106
2700 4275
107+
0.000 1.000 1.000 1.000 1.000 1.000 0.000
102108
3 2 2 2 20 7 0 0 -1 6.000 1 1 0 5
103109
0 0 2.00 150.00 180.00
104110
2550 2175 3225 2475 5400 2550 6225 2625 6450 2775
105-
0.00 0.00 2927.81 2370.42 3096.56 2445.42 3729.54 2591.19
106-
4904.72 2518.98 5588.53 2561.81 6033.83 2557.52 6271.80 2641.52
107-
6328.05 2679.02 0.00 0.00
111+
0.000 -1.000 -1.000 -1.000 0.000
108112
4 1 -1 0 0 16 18 0.0000 4 210 900 1560 11190 Utilities\001
109113
4 1 -1 0 0 16 18 0.0000 4 270 2265 7965 11190 Storage Managers\001
110114
4 1 -1 0 0 16 18 0.0000 4 270 960 4725 11175 Catalog\001

src/tools/backend/flow.jpg

-7.63 KB
Loading

0 commit comments

Comments
 (0)