• Tom Lane's avatar
    Remove arbitrary line length limits in pg_regress (plain and ECPG). · 784b1ba1
    Tom Lane authored
    Refactor replace_string() to use a StringInfo for the modifiable
    string argument.  This allows the string to be of indefinite size
    initially and/or grow substantially during replacement.  The previous
    logic in convert_sourcefiles_in() had a hard-wired limit of 1024
    bytes on any line in input/*.sql or output/*.out files.  While we've
    not had reports of trouble yet, it'd surely have bit us someday.
    
    This also fixes replace_string() so it won't get into an infinite
    loop if the string-to-be-replaced is a substring of the replacement.
    That's unlikely to happen in current usage, but the function surely
    shouldn't depend on it.
    
    Also fix ecpg_filter() to use a StringInfo and thereby remove its
    hard limit of 300 bytes on the length of an ecpg source line.
    
    Asim Rama Praveen and Georgios Kokolatos,
    reviewed by Alvaro Herrera and myself
    
    Discussion: https://postgr.es/m/y9Dlk2QhiZ39DhaB1QE9mgZ95HcOQKZCNtGwN7XCRKMdBRBnX_0woaRUtTjloEp4PKA6ERmcUcfq3lPGfKPOJ5xX2TV-5WoRYyySeNHRzdw=@protonmail.com
    784b1ba1
pg_regress_ecpg.c 4.44 KB