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

Commit14ffdd8

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 parentfda3e65 commit14ffdd8

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

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

4042
%%
4143

44+
%{
45+
litbuf = pg_malloc(LITBUF_INIT);
46+
litbufsize = LITBUF_INIT;
47+
%}
48+
4249
permutation{return(PERMUTATION); }
4350
session{return(SESSION); }
4451
setup{return(SETUP); }
@@ -96,10 +103,12 @@ teardown{ return(TEARDOWN); }
96103
staticvoid
97104
addlitchar(char c)
98105
{
99-
if (litbufpos >=sizeof(litbuf) -1)
106+
/* We must always leave room to add a trailing \0 */
107+
if (litbufpos >= litbufsize -1)
100108
{
101-
fprintf(stderr,"SQL step too long\n");
102-
exit(1);
109+
/* Double the size of litbuf if it gets full */
110+
litbufsize += litbufsize;
111+
litbuf =pg_realloc(litbuf, litbufsize);
103112
}
104113
litbuf[litbufpos++] = c;
105114
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp