Re: Allowing line-continuation in pgbench custom scripts

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing line-continuation in pgbench custom scripts
Date: 2014-05-26 16:12:50
Message-ID: CA+HiwqEf2UZ9E3h=tmz_JRqDbKKv_k+z76VaYqBRXrXhiqgPhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 27, 2014 at 12:44 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Amit Langote <amitlangote09(at)gmail(dot)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).
>

Sorry, the patch was in a really bad shape. Should have pondered these
points before submitting it.

Even if I drop the backslash line-continuation idea and decide to use
semi-colons as SQL command separators, given the compatibility issues
mentioned downthread, it would not be worthwhile.

--
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-05-26 16:17:18 Re: IMPORT FOREIGN SCHEMA statement
Previous Message Hannu Krosing 2014-05-26 16:11:04 Re: Priority table or Cache table