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

Commit38a1144

Browse files
committed
Remove restriction on SQL block length in isolationtester scanner.
specscanner.l had a fixed limit of 1024 bytes on the length ofindividual SQL stanzas in an isolation test script. People arestarting to run into that, so fix it by making the buffer resizable.Once we allow this in HEAD, it seems inevitable that somebody willtry to back-patch a test that exceeds the old limit, so back-patchthis change as a preventive measure.Daniel GustafssonDiscussion:https://postgr.es/m/8D628BE4-6606-4FF6-A3FF-8B2B0E9B43D0@yesql.se
1 parent2af28e6 commit38a1144

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

‎src/test/isolation/specscanner.l

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
staticintyyline =1;/* line number for error reporting*/
1414

15-
staticchar litbuf[1024];
16-
staticint litbufpos =0;
15+
#defineLITBUF_INIT1024/* initial size of litbuf*/
16+
staticchar *litbuf =NULL;
17+
staticsize_t litbufsize =0;
18+
staticsize_t litbufpos =0;
1719

1820
staticvoidaddlitchar(char c);
1921

@@ -41,6 +43,11 @@ comment("#"{non_newline}*)
4143

4244
%%
4345

46+
%{
47+
litbuf = pg_malloc(LITBUF_INIT);
48+
litbufsize = LITBUF_INIT;
49+
%}
50+
4451
permutation{return PERMUTATION; }
4552
session{return SESSION; }
4653
setup{return SETUP; }
@@ -100,10 +107,12 @@ teardown{ return TEARDOWN; }
100107
staticvoid
101108
addlitchar(char c)
102109
{
103-
if (litbufpos >=sizeof(litbuf) -1)
110+
/* We must always leave room to add a trailing \0 */
111+
if (litbufpos >= litbufsize -1)
104112
{
105-
fprintf(stderr,"SQL step too long\n");
106-
exit(1);
113+
/* Double the size of litbuf if it gets full */
114+
litbufsize += litbufsize;
115+
litbuf =pg_realloc(litbuf, litbufsize);
107116
}
108117
litbuf[litbufpos++] = c;
109118
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp