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

Commita2226ad

Browse files
committed
contrib-array.patch
this is an old patch which I have already submitted and never seen in the sources. It corrects the datatype oids used in some iterator functions. This bug has been reported to me by many other people.contrib-datetime.patch some code contributed by Reiner Dassing <dassing@wettzell.ifag.de>contrib-makefiles.patch fixes all my contrib makefiles which don't work with some compilers, as reported to me by another user.contrib-miscutil.patch an old patch for one of my old contribs.contrib-string.patch a small change to the c-like text output functions. Now the '{' is escaped only at the beginning of the string to distinguish it from arrays, and the '}' is no more escaped.elog-lineno.patch adds the current lineno of CopyFrom to elog messages. This is very useful when you load a 1 million tuples table from an external file and there is a bad value somehere. Currently you get an error message but you can't know where is the bad data. The patch uses a variable which was declared static in copy.c. The variable is now exported and initialized to 0. It is always cleared at the end of the copy or at the first elog message or when the copy is canceled. I know this is very ugly but I can't find any better way of knowing where the copy fails and I have this problem quite often.plperl-makefile.patch fixes a typo in a makefile, but the error must be elsewhere because it is a file generated automatically. Please have a look.tprintf-timestamp.patch restores the original 2-digit year format, assuming that the two century digits don't carry much information and that '000202' is easier to read than 20000202. Being only a log file it shouldn't break anything.Please apply the patches before the next scheduled code freeze.I also noticed that some of the contribs don't compile correcly. Should weask people to fix their code or rename their makefiles so that they areignored by the top makefile?--Massimo Dal Zotto
1 parent77d31cf commita2226ad

File tree

17 files changed

+102
-67
lines changed

17 files changed

+102
-67
lines changed

‎contrib/array/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SRCDIR = $(PGDIR)/src
1111

1212
include$(SRCDIR)/Makefile.global
1313

14-
INCLUDE_OPT =-I./\
15-
-I$(SRCDIR)/\
16-
-I$(SRCDIR)/include\
17-
-I$(SRCDIR)/port/$(PORTNAME)
14+
INCLUDE_OPT =-I./\
15+
-I$(SRCDIR)/\
16+
-I$(SRCDIR)/include\
17+
-I$(SRCDIR)/port/$(PORTNAME)
1818

1919
CFLAGS +=$(INCLUDE_OPT)$(CFLAGS_SL)
2020

‎contrib/array/array_iterator.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
6666
}
6767

6868
/* Lookup element type information */
69-
typ_tuple=SearchSysCacheTuple(TYPOID,ObjectIdGetDatum(elemtype),0,0,0);
69+
typ_tuple=SearchSysCacheTuple(TYPEOID,ObjectIdGetDatum(elemtype),0,0,0);
7070
if (!HeapTupleIsValid(typ_tuple))
7171
{
7272
elog(ERROR,"array_iterator: cache lookup failed for type %d",elemtype);
@@ -183,7 +183,7 @@ array_all_textregexeq(ArrayType *array, char *value)
183183
int32
184184
array_varchareq(ArrayType*array,char*value)
185185
{
186-
returnarray_iterator((Oid)20,/* varchar */
186+
returnarray_iterator((Oid)1043,/* varchar */
187187
(Oid)1070,/* varchareq */
188188
0,/* logical or */
189189
array, (Datum)value);
@@ -192,7 +192,7 @@ array_varchareq(ArrayType *array, char *value)
192192
int32
193193
array_all_varchareq(ArrayType*array,char*value)
194194
{
195-
returnarray_iterator((Oid)20,/* varchar */
195+
returnarray_iterator((Oid)1043,/* varchar */
196196
(Oid)1070,/* varchareq */
197197
1,/* logical and */
198198
array, (Datum)value);
@@ -201,7 +201,7 @@ array_all_varchareq(ArrayType *array, char *value)
201201
int32
202202
array_varcharregexeq(ArrayType*array,char*value)
203203
{
204-
returnarray_iterator((Oid)20,/* varchar */
204+
returnarray_iterator((Oid)1043,/* varchar */
205205
(Oid)1254,/* textregexeq */
206206
0,/* logical or */
207207
array, (Datum)value);
@@ -210,7 +210,7 @@ array_varcharregexeq(ArrayType *array, char *value)
210210
int32
211211
array_all_varcharregexeq(ArrayType*array,char*value)
212212
{
213-
returnarray_iterator((Oid)20,/* varchar */
213+
returnarray_iterator((Oid)1043,/* varchar */
214214
(Oid)1254,/* textregexeq */
215215
1,/* logical and */
216216
array, (Datum)value);
@@ -224,7 +224,7 @@ array_all_varcharregexeq(ArrayType *array, char *value)
224224
int32
225225
array_bpchareq(ArrayType*array,char*value)
226226
{
227-
returnarray_iterator((Oid)20,/* bpchar */
227+
returnarray_iterator((Oid)1042,/* bpchar */
228228
(Oid)1048,/* bpchareq */
229229
0,/* logical or */
230230
array, (Datum)value);
@@ -233,7 +233,7 @@ array_bpchareq(ArrayType *array, char *value)
233233
int32
234234
array_all_bpchareq(ArrayType*array,char*value)
235235
{
236-
returnarray_iterator((Oid)20,/* bpchar */
236+
returnarray_iterator((Oid)1042,/* bpchar */
237237
(Oid)1048,/* bpchareq */
238238
1,/* logical and */
239239
array, (Datum)value);
@@ -242,7 +242,7 @@ array_all_bpchareq(ArrayType *array, char *value)
242242
int32
243243
array_bpcharregexeq(ArrayType*array,char*value)
244244
{
245-
returnarray_iterator((Oid)20,/* bpchar */
245+
returnarray_iterator((Oid)1042,/* bpchar */
246246
(Oid)1254,/* textregexeq */
247247
0,/* logical or */
248248
array, (Datum)value);
@@ -251,7 +251,7 @@ array_bpcharregexeq(ArrayType *array, char *value)
251251
int32
252252
array_all_bpcharregexeq(ArrayType*array,char*value)
253253
{
254-
returnarray_iterator((Oid)20,/* bpchar */
254+
returnarray_iterator((Oid)1042,/* bpchar */
255255
(Oid)1254,/* textregexeq */
256256
1,/* logical and */
257257
array, (Datum)value);

‎contrib/datetime/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SRCDIR = $(PGDIR)/src
1111

1212
include$(SRCDIR)/Makefile.global
1313

14-
INCLUDE_OPT =-I./\
15-
-I$(SRCDIR)/\
16-
-I$(SRCDIR)/include\
17-
-I$(SRCDIR)/port/$(PORTNAME)
14+
INCLUDE_OPT =-I./\
15+
-I$(SRCDIR)/\
16+
-I$(SRCDIR)/include\
17+
-I$(SRCDIR)/port/$(PORTNAME)
1818

1919
CFLAGS +=$(INCLUDE_OPT)$(CFLAGS_SL)
2020

‎contrib/datetime/datetime_functions.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*
66
* Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it>
77
*
8+
* Date2mjd code contributed by Reiner Dassing <dassing@wettzell.ifag.de>
9+
*
810
* This software is distributed under the GNU General Public License
911
* either version 2, or (at your option) any later version.
1012
*/
@@ -73,7 +75,7 @@ decode_24h_time(char *str, struct tm *tm, double *fsec)
7375
if ( (tm->tm_hour<0)|| (tm->tm_hour>24)
7476
|| (tm->tm_min<0)|| (tm->tm_min>59)
7577
|| (tm->tm_sec<0)|| (tm->tm_sec>59)
76-
|| (fsec<0) )
78+
|| (*fsec<0) )
7779
return-1;
7880

7981
return0;
@@ -260,6 +262,16 @@ currentdate()
260262
return (date);
261263
}
262264

265+
int4
266+
date2mjd(DateADTval)
267+
{
268+
intresult;
269+
270+
result=val+JDATE_2000-2400000.5;
271+
272+
returnresult;
273+
}
274+
263275
/* end of file */
264276

265277
/*

‎contrib/miscutil/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SRCDIR = $(PGDIR)/src
1111

1212
include$(SRCDIR)/Makefile.global
1313

14-
INCLUDE_OPT =-I./\
15-
-I$(SRCDIR)/\
16-
-I$(SRCDIR)/include\
17-
-I$(SRCDIR)/port/$(PORTNAME)
14+
INCLUDE_OPT =-I./\
15+
-I$(SRCDIR)/\
16+
-I$(SRCDIR)/include\
17+
-I$(SRCDIR)/port/$(PORTNAME)
1818

1919
CFLAGS +=$(INCLUDE_OPT)$(CFLAGS_SL)
2020

‎contrib/miscutil/misc_utils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ active_listeners(text *relname)
121121
returncount;
122122
}
123123

124+
#ifdefUSE_ASSERT_CHECKING
124125
int
125126
assert_enable(intval)
126127
{
@@ -134,6 +135,7 @@ assert_test(int val)
134135
returnassertTest(val);
135136
}
136137
#endif
138+
#endif
137139

138140
/* end of file */
139141

‎contrib/miscutil/misc_utils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ intbackend_pid(void);
66
intunlisten(char*relname);
77
intmax(intx,inty);
88
intmin(intx,inty);
9-
intassert_enable(intval);
9+
intactive_listeners(text*relname);
1010

11+
#ifdefUSE_ASSERT_CHECKING
12+
intassert_enable(intval);
1113
#ifdefASSERT_CHECKING_TEST
1214
intassert_test(intval);
1315
#endif
16+
#endif
1417

15-
intactive_listeners(text*relname);
1618
#endif
1719

1820
/*

‎contrib/string/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SRCDIR = $(PGDIR)/src
1111

1212
include$(SRCDIR)/Makefile.global
1313

14-
INCLUDE_OPT =-I./\
15-
-I$(SRCDIR)/\
16-
-I$(SRCDIR)/include\
17-
-I$(SRCDIR)/port/$(PORTNAME)
14+
INCLUDE_OPT =-I./\
15+
-I$(SRCDIR)/\
16+
-I$(SRCDIR)/include\
17+
-I$(SRCDIR)/port/$(PORTNAME)
1818

1919
CFLAGS +=$(INCLUDE_OPT)$(CFLAGS_SL)
2020

‎contrib/string/string_io.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
*representation of data.
5151
*/
5252

53-
char*
54-
string_output(char*data,intsize)
53+
unsignedchar*
54+
string_output(unsignedchar*data,intsize)
5555
{
5656
registerunsignedcharc,
5757
*p,
@@ -79,8 +79,6 @@ string_output(char *data, int size)
7979
{
8080
case'\\':
8181
case'"':
82-
case'{':
83-
case'}':
8482
case'\b':
8583
case'\f':
8684
case'\n':
@@ -89,6 +87,12 @@ string_output(char *data, int size)
8987
case'\v':
9088
len++;
9189
break;
90+
case'{':
91+
/* Escape beginning of string, to distinguish from arrays */
92+
if (p==data) {
93+
len++;
94+
}
95+
break;
9296
default:
9397
if (NOTPRINTABLE(*p))
9498
len+=3;
@@ -104,8 +108,6 @@ string_output(char *data, int size)
104108
{
105109
case'\\':
106110
case'"':
107-
case'{':
108-
case'}':
109111
*r++='\\';
110112
*r++=c;
111113
break;
@@ -133,6 +135,13 @@ string_output(char *data, int size)
133135
*r++='\\';
134136
*r++='v';
135137
break;
138+
case'{':
139+
/* Escape beginning of string, to distinguish from arrays */
140+
if (p==data) {
141+
*r++='\\';
142+
}
143+
*r++=c;
144+
break;
136145
default:
137146
if (NOTPRINTABLE(c))
138147
{
@@ -180,8 +189,8 @@ string_output(char *data, int size)
180189
*a pointer to the new string or the header.
181190
*/
182191

183-
char*
184-
string_input(char*str,intsize,inthdrsize,int*rtn_size)
192+
unsignedchar*
193+
string_input(unsignedchar*str,intsize,inthdrsize,int*rtn_size)
185194
{
186195
registerunsignedchar*p,
187196
*r;
@@ -285,7 +294,7 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
285294
return ((char*)result);
286295
}
287296

288-
char*
297+
unsignedchar*
289298
c_charout(int32c)
290299
{
291300
charstr[2];
@@ -300,7 +309,7 @@ c_charout(int32 c)
300309
* This can be used for SET, bytea, text and unknown data types
301310
*/
302311

303-
char*
312+
unsignedchar*
304313
c_textout(structvarlena*vlena)
305314
{
306315
intlen=0;
@@ -318,8 +327,8 @@ c_textout(struct varlena * vlena)
318327
* This can be used for varchar and bpchar strings
319328
*/
320329

321-
char*
322-
c_varcharout(char*s)
330+
unsignedchar*
331+
c_varcharout(unsignedchar*s)
323332
{
324333
intlen=0;
325334

@@ -333,7 +342,7 @@ c_varcharout(char *s)
333342

334343
#if0
335344
structvarlena*
336-
c_textin(char*str)
345+
c_textin(unsignedchar*str)
337346
{
338347
structvarlena*result;
339348
intlen;
@@ -348,7 +357,7 @@ c_textin(char *str)
348357
}
349358

350359
int32*
351-
c_charin(char*str)
360+
c_charin(unsignedchar*str)
352361
{
353362
return (string_input(str,1,0,NULL));
354363
}

‎contrib/string/string_io.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
#ifndefSTRING_IO_H
22
#defineSTRING_IO_H
33

4-
char*string_output(char*data,intsize);
5-
char*string_input(char*str,intsize,inthdrsize,int*rtn_size);
6-
char*c_charout(int32c);
7-
char*c_char2out(uint16s);
8-
char*c_char4out(uint32s);
9-
char*c_char8out(char*s);
10-
char*c_char16out(char*s);
11-
char*c_textout(structvarlena*vlena);
12-
char*c_varcharout(char*s);
4+
unsignedchar*string_output(unsignedchar*data,intsize);
5+
unsignedchar*string_input(unsignedchar*str,intsize,inthdrsize,
6+
int*rtn_size);
7+
unsignedchar*c_charout(int32c);
8+
unsignedchar*c_textout(structvarlena*vlena);
9+
unsignedchar*c_varcharout(unsignedchar*s);
1310

1411
#if0
15-
structvarlena*c_textin(char*str);
16-
char*c_char16in(char*str);
12+
structvarlena*c_textin(unsignedchar*str);
13+
int32*c_charin(unsignedchar*str)
1714
#endif
1815

1916
#endif

‎contrib/userlock/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SRCDIR = $(PGDIR)/src
1111

1212
include$(SRCDIR)/Makefile.global
1313

14-
INCLUDE_OPT =-I./\
15-
-I$(SRCDIR)/\
16-
-I$(SRCDIR)/include\
17-
-I$(SRCDIR)/port/$(PORTNAME)
14+
INCLUDE_OPT =-I./\
15+
-I$(SRCDIR)/\
16+
-I$(SRCDIR)/include\
17+
-I$(SRCDIR)/port/$(PORTNAME)
1818

1919
CFLAGS +=$(INCLUDE_OPT)$(CFLAGS_SL)
2020

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp