Re: [PATCHES] Patch to allow contrib/pgbench files to have blank lines - Mailing list pgsql-bugs

From Nicolas Barbier
Subject Re: [PATCHES] Patch to allow contrib/pgbench files to have blank lines
Date
Msg-id b0f3f5a10512071309p48c6e8c1nc3eeb2d2c7b52ba8@mail.gmail.com
Whole thread Raw
In response to Patch to allow contrib/pgbench files to have blank lines  (David Fetter <david@fetter.org>)
List pgsql-bugs
On 11/23/05, David Fetter <david@fetter.org> wrote:

> Having blank lines in -f scripts was causing silent failures.  This
> fixes it, for some value of "fixes."  If it's OK, please apply to 8.1
> CURRENT and CVS TIP :)

> if (strncmp(buf, "\n", 1) != 0) {
>     commands = process_commands(buf);
>     if (commands == NULL)
>     {
>         fclose(fd);
>         return false;
>     }
> } else {
>     lineno++;

Above line will cause a skip in the my_commands array, leaving a
garbage pointer. Removing it will fix things.

>     continue;
> }
>
> my_commands[lineno] = commands;

--
Nicolas Barbier
http://www.gnu.org/philosophy/no-word-attachments.html

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2096: bug in a SPI sample document
Next
From: "Kasahara Kenichi"
Date:
Subject: There is a doubt of fatal bug on PostgreSQL 8.0.4.