Re: Allowing line-continuation in pgbench custom scripts - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allowing line-continuation in pgbench custom scripts
Date
Msg-id 26266.1401119071@sss.pgh.pa.us
Whole thread Raw
In response to Allowing line-continuation in pgbench custom scripts  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: Allowing line-continuation in pgbench custom scripts  (Amit Langote <amitlangote09@gmail.com>)
Re: Allowing line-continuation in pgbench custom scripts  (Jeff Janes <jeff.janes@gmail.com>)
Re: Allowing line-continuation in pgbench custom scripts  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Amit Langote <amitlangote09@gmail.com> writes:
> In a custom pgbench script, it seems convenient to be able to split a
> really long query to span multiple lines using an escape character
> (bash-style). Attached adds that capability to read_line_from_file()
> in pgbench.c

This seems pretty likely to break existing scripts that happen to contain
backslashes.  Is it really worth the compatibility risk?

The patch as written has got serious problems even discounting any
compatibility risk: it will be fooled by a backslash near the end of a
bufferload that doesn't end with a newline, and it doesn't allow for
DOS-style newlines (\r\n), and it indexes off the array if the buffer
contains *only* a newline (and, assuming that it fails to crash in that
case, it'd also fail to note a backslash that had been in the previous
bufferload).
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Allowing line-continuation in pgbench custom scripts
Next
From: Tom Lane
Date:
Subject: Re: Allowing line-continuation in pgbench custom scripts