Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lroXs-0007cb-9X for pgsql-docs@arkaria.postgresql.org; Fri, 11 Jun 2021 21:18:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lroXr-0007V3-1G for pgsql-docs@arkaria.postgresql.org; Fri, 11 Jun 2021 21:18:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrme7-0002Lv-Tf for pgsql-docs@lists.postgresql.org; Fri, 11 Jun 2021 19:16:47 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lrme1-0004B6-L8 for pgsql-docs@lists.postgresql.org; Fri, 11 Jun 2021 19:16:46 +0000 Received: by mail-lf1-x130.google.com with SMTP id f30so10097841lfj.1 for ; Fri, 11 Jun 2021 12:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3doEuO487KjJlYJBqQB6PgLhRZll2Qy7id6JpIRY+8Q=; b=jtHe2YJr2gYH67pSEabHnJ4m2IIVv9BWNTq8qPk2yOiZT6oexgz9k3oEDH0lBfoz2M ca3oFSs8B+SNX2legYYQ36mvdvGy8h/uBloGSuhbtyVEw/9B0iUHm0R+OfBHGwcfskFW J/ZWoM8iqjM8HHe3CrEiiMO5wZ26VDB334/Pwr5FeHn2IIXnc9PbmR54HVbifo/gEinh tP31jYL588Tnf2LewrQ5GZ9Xi30NN7ImDYkkDsjMQv40SWaDWoftwXW18zEpS3PW3UkR yrlQ4wzWq8NsATNZM0mReOvV8bOYB8TSAg5Bgphm3e8im7sI8a8j83ybqURTVuz/Yveg WPOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3doEuO487KjJlYJBqQB6PgLhRZll2Qy7id6JpIRY+8Q=; b=j1FMoApuUCwiMhVrT7BwauebK8hzYIHPy9XrWS77ao62GFM5SYIonT+QxZoTIgarku 20CqzC46HB16DYEg1HntBWWNlt1VDfhkf2PkiPlcLodFNMluQSPExGvqkxM24v7Q62Cq zIB3hrg1PSsY6sBwIgjrLtxfhtNLI7CQGTWJinZXgC1SPNnLSWD9WfxENfbJvPFroGKx XKLx7O1AZ7nXIQ8ezEhPdjfzraokQYIIVVZ8uNQO5fB+F3SEe/WQaDBkY2Z4gGb197X3 DNsPU0jfMS7uexNXEI1bbhFtCsYK2D8FU2RYu79vm0+Uv3GVbqGLaXeDZc9oem/Nog/S o78Q== X-Gm-Message-State: AOAM532/jt64dV7XyuMp99JHHVNgvkKAiLj8ydmnWPEwOxoqRf6iessS DUEkRawqFFoipd+tWLsbcOnW6ISAljo2hdtGEYk5GgM3 X-Google-Smtp-Source: ABdhPJwtr40OJ8dSSnRJ5Fatn1s9z5uAt66k4c4/3T+qDil2sRG7E5IJ5gwafCCt+c+fydCt8GUB5I2taiKnLvPXZtA= X-Received: by 2002:ac2:430e:: with SMTP id l14mr3484962lfh.418.1623439000055; Fri, 11 Jun 2021 12:16:40 -0700 (PDT) MIME-Version: 1.0 References: <162326849405.14468.13255406860802922380@wrigleys.postgresql.org> <1510077.1623275238@sss.pgh.pa.us> In-Reply-To: <1510077.1623275238@sss.pgh.pa.us> From: Neil Bower Date: Fri, 11 Jun 2021 13:16:29 -0600 Message-ID: Subject: Re: SQL Commands COPY To: Tom Lane Cc: Laurenz Albe , pgsql-docs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000e9b1fa05c482581b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e9b1fa05c482581b Content-Type: text/plain; charset="UTF-8" It was a picnic. I was confusing the 9+ version syntax with the pre-9 version syntax at the bottom of the page. Most of the options between the two versions are the same and the pre-9 version still works with the newer versions of PostgreSQL. I was connecting to a version 13 server at the time. I've been using this same syntax for several years and never noticed the one key difference between the older and newer versions of the syntax of having to enclose the options within round brackets until Laurenz's example. Thanks! On Wed, 9 Jun 2021 at 15:47, Tom Lane wrote: > Laurenz Albe writes: > > On Wed, 2021-06-09 at 19:54 +0000, PG Doc comments form wrote: > >> When using psql (version 13.3) against a version 13 cluster, the method > >> shown in the compatibility section works whereas the methods shown in > the > >> synopsis and parameters sections do not work and will throw a syntax > >> error. > > > You must be misreading something, the new syntax works: > > COPY (SELECT 42 AS x) TO STDOUT (FORMAT 'csv', FORCE_QUOTE (x)); > > The most probable explanation seems to be that the OP is actually > connecting to an 8.4 (or older) PG server. > > regards, tom lane > --000000000000e9b1fa05c482581b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It was a picnic. I was confusing the 9+ v= ersion syntax with the pre-9 version syntax at the bottom of the page. Most= of the options between the two versions are the same and the pre-9 version= still works with the newer versions of PostgreSQL.

I wa= s connecting to a version 13 server at the time. I've been using this s= ame syntax for several years and never noticed the one key difference betwe= en the older and newer versions of the syntax of having to enclose the opti= ons within round brackets until Laurenz's example.=C2=A0

=
Thanks!

On Wed, 9 Jun 2021 at 15:47, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Laurenz Albe <laurenz.albe@cybertec.at= > writes:
> On Wed, 2021-06-09 at 19:54 +0000, PG Doc comments form wrote:
>> When using psql (version 13.3) against a version 13 cluster, the m= ethod
>> shown in the compatibility section works whereas the methods shown= in the
>> synopsis and parameters sections do not work and will throw a synt= ax
>> error.

> You must be misreading something, the new syntax works:
> COPY (SELECT 42 AS x) TO STDOUT (FORMAT 'csv', FORCE_QUOTE (x)= );

The most probable explanation seems to be that the OP is actually
connecting to an 8.4 (or older) PG server.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--000000000000e9b1fa05c482581b--