diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index a808546..f68acb2 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -697,11 +697,13 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
   </para>
 
   <para>
-   The format of a script file is one SQL command per line; multiline
-   SQL commands are not supported.  Empty lines and lines beginning with
-   <literal>--</> are ignored.  Script file lines can also be
-   <quote>meta commands</>, which are interpreted by <application>pgbench</>
-   itself, as described below.
+   The format of a script file is composed of lines which are each either
+   one SQL command or one <quote>meta command</> interpreted by
+   <application>pgbench</> itself, as described below.
+   Commands can be spread over multiple lines using backslash (<literal>\</>)
+   continuations, in which case the set of continuated lines is considered
+   as just one line.
+   Empty lines and lines beginning with <literal>--</> are ignored.
   </para>
 
   <para>
@@ -769,7 +771,8 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
       Examples:
 <programlisting>
 \set ntellers 10 * :scale
-\set aid (1021 * :aid) % (100000 * :scale) + 1
+\set aid \
+  (1021 * :aid) % (100000 * :scale) + 1
 </programlisting></para>
     </listitem>
    </varlistentry>
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 8b8b591..8991702 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -2437,7 +2437,7 @@ process_commands(char *buf, const char *source, const int lineno)
 }
 
 /*
- * Read a line from fd, and return it in a malloc'd buffer.
+ * Read a possibly \-continuated line from fd, and return it in a malloc'd buffer.
  * Return NULL at EOF.
  *
  * The buffer will typically be larger than necessary, but we don't care
@@ -2462,9 +2462,25 @@ read_line_from_file(FILE *fd)
 		memcpy(buf + used, tmpbuf, thislen + 1);
 		used += thislen;
 
-		/* Done if we collected a newline */
-		if (thislen > 0 && tmpbuf[thislen - 1] == '\n')
-			break;
+		/* If we collected a newline */
+		if (used > 0 && buf[used - 1] == '\n')
+		{
+			/* Handle simple \-continuations */
+			if (used >= 2 && buf[used - 2] == '\\')
+			{
+				buf[used - 2] = '\0';
+				used -= 2;
+			}
+			else if (used >= 3 && buf[used - 2] == '\r' &&
+					 buf[used - 3] == '\\')
+			{
+				buf[used - 3] = '\0';
+				used -= 3;
+			}
+			else
+				/* Else we are done */
+				break;
+		}
 
 		/* Else, enlarge buf to ensure we can append next bufferload */
 		buflen += BUFSIZ;
