From mwtoews@gmail.com Mon Jun 1 08:15:55 2026 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TY5ZV-0000Uy-72 for pgsql-docs@postgresql.org; Tue, 13 Nov 2012 01:45:49 +0000 Received: from mail-oa0-f46.google.com ([209.85.219.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TY5ZS-0002dj-Vy for pgsql-docs@postgresql.org; Tue, 13 Nov 2012 01:45:48 +0000 Received: by mail-oa0-f46.google.com with SMTP id h16so6936825oag.19 for ; Mon, 12 Nov 2012 17:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Owh51+X9CA6Nw3MR/PU1uGb8HQ6Gmz02zHBfwZ3nISQ=; b=cpTXTnN6A5I2FyTFVpGEP6MVG+pYaM95Mjv6QLudAG+P1NodJkpQw+jQarinQNsJE3 mUsoxlN8c/GQED7HDzIljFtftojGyQJLpaOl/OP1S0XlPupElLd3Z7fXT+1YX8T+csVJ wQJ/3V186d2/Z6zPyav2e6L/8l4B3ptXjkuQRNfWojWavsjiBbyeqC5bt1uimUEFQ5ka eQrzP2TeQMmXgaNWXwnmDnrCdJjk2Kjg6F8A3naljKXzkZrrQLh/eESmf3rZjruE/36I gi+2Ya3ecANC0v71i0EO1MpoY9Ah5DKBZBUpKsOT6vWUtOfnkMZgzfrEzq0XugiFW8AO NV2w== Received: by 10.182.31.50 with SMTP id x18mr16447471obh.56.1352771145642; Mon, 12 Nov 2012 17:45:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.60.13.196 with HTTP; Mon, 12 Nov 2012 17:45:05 -0800 (PST) From: Mike Toews Date: Tue, 13 Nov 2012 14:45:05 +1300 Message-ID: Subject: pg_dump -t '"Table"' for cmd.exe To: pgsql-docs@postgresql.org Content-Type: multipart/alternative; boundary=14dae93b56d499331404ce569378 X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201211/8 X-Sequence-Number: 7500 --14dae93b56d499331404ce569378 Content-Type: text/plain; charset=ISO-8859-1 I'm not sure if this is worth documenting, but pg_dumping mixed-case tables with the '-t table' option appears to not be accurately documented for cmd.exe. Here are my four attempts, with only the last as success: Intuitive (supplying "My Table" like "My Database"), but not correct: C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t "My Table" "My Database" pg_dump: No matching tables were found As documented in last example at http://www.postgresql.org/docs/9.1/static/app-pgdump.html C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t '"My Table"' "My Database" pg_dump: No matching tables were found Escaping quotes, but using single quotes: C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t '\"My Table\"' "My Database" pg_dump: too many command-line arguments (first is "My Database") Escaping quotes, but using double quotes: C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t "\"My Table\"" "My Database" works! -Mike --14dae93b56d499331404ce569378 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm not sure if this is worth documenting, but pg_dumpin= g mixed-case tables with the '-t table' option appears to not be ac= curately documented for=A0cmd.exe. Here are my four attempts, with only the= last as success:

Intuitive (supplying "My Table" like "My= Database"), but not correct:
C:\>"C:\Program Files\= PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t "My Table" &q= uot;My Database"
pg_dump: No matching tables were found

C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe"= ; -U postgres -t '"My Table"' "My Database"
pg_dump: No matching tables were found

Escaping quotes, but using single quotes:
C:\= >"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres= -t '\"My Table\"' "My Database"
pg_dump: too many command-line arguments (first is "My Database")=

Escaping quotes, but using double quotes:
C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe"= -U postgres -t "\"My Table\"" "My Database"<= /div>

works!

-Mike
--14dae93b56d499331404ce569378-- From schmiddy@gmail.com Mon Jun 1 08:15:55 2026 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYTyq-0006HI-Q8 for pgsql-docs@postgresql.org; Wed, 14 Nov 2012 03:49:36 +0000 Received: from mail-ob0-f172.google.com ([209.85.214.172]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYTyo-0003Bt-G9 for pgsql-docs@postgresql.org; Wed, 14 Nov 2012 03:49:36 +0000 Received: by mail-ob0-f172.google.com with SMTP id ef5so451obb.31 for ; Tue, 13 Nov 2012 19:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=phdfbWQFiH7YZdy2bJGFEee2bilgusSObkQHtpT+Wro=; b=Fqt0GW4jwKKVrz6f0xBVZ7svGRIgO/HGMClIU/7HWlsTfT8hgMxFSgeX7ik+lExgVB 4XniaB3sYP32d3M+ZzFEpLS7NV8Wp9SX12zzHZGmk72bRdBkBeVWIIaVKQbmgwM2/jMy 9vOmCTVXCHPy3lNAY7IWHnK5mB04d7ozbMmlY9uKDanEM+hkLXhP9cK+FrY/yOU0j5US VsodW4LmpdKTQaMmQzbmAGbQGYNSaXcfZbZDVVfVbHgx1nTtIjkYV5h6wotGkH5zUcdh Hd2IoSNPOYaSTlFHTQmmtdMbABEFU9ypG+QF1wESisMA12ysOpxtXRU/vmBxucTH13nA InZw== Received: by 10.60.12.225 with SMTP id b1mr19389951oec.96.1352864973059; Tue, 13 Nov 2012 19:49:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.60.79.130 with HTTP; Tue, 13 Nov 2012 19:49:12 -0800 (PST) In-Reply-To: References: From: Josh Kupershmidt Date: Tue, 13 Nov 2012 22:49:12 -0500 Message-ID: Subject: Re: pg_dump -t '"Table"' for cmd.exe To: Mike Toews Cc: pgsql-docs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201211/9 X-Sequence-Number: 7501 On Mon, Nov 12, 2012 at 8:45 PM, Mike Toews wrote: > I'm not sure if this is worth documenting, but pg_dumping mixed-case tables > with the '-t table' option appears to not be accurately documented for > cmd.exe. Here are my four attempts, with only the last as success: I believe this complaint is basically the same as this recent one: http://archives.postgresql.org/pgsql-bugs/2012-10/msg00044.php and this behavior confused me recently as well. I agree the behavior should be documented, though it should be documented for all our utilities which accept a --table argument and pass it on as a supposedly already-escaped identifier. Incidentally, I'm really not fond of the existing behavior because it: a.) is counterintuitive b.) requires the user to escape table names themselves, and how were they even supposed to have a chance of programmatically doing this properly before we exposed PQescapeIdentifier() c.) opens possible SQL injection holes, e.g. reindexdb --table='foo; ALTER ROLE limited WITH superuser' Josh From bruce@momjian.us Mon Jun 1 08:15:55 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UtjEV-0005st-QK for pgsql-docs@arkaria.postgresql.org; Mon, 01 Jul 2013 18:53:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UtjEV-0001er-3h for pgsql-docs@arkaria.postgresql.org; Mon, 01 Jul 2013 18:53:51 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UtjES-0001aU-EL for pgsql-docs@postgresql.org; Mon, 01 Jul 2013 18:53:48 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UtjEL-0006Ip-K0 for pgsql-docs@postgresql.org; Mon, 01 Jul 2013 18:53:47 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1UtjEL-00073D-3G; Mon, 01 Jul 2013 14:53:41 -0400 Date: Mon, 1 Jul 2013 14:53:41 -0400 From: Bruce Momjian To: Mike Toews Cc: pgsql-docs@postgresql.org Subject: Re: pg_dump -t '"Table"' for cmd.exe Message-ID: <20130701185341.GF16348@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qcHopEYAB45HaUaB" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --qcHopEYAB45HaUaB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Nov 13, 2012 at 02:45:05PM +1300, Mike Toews wrote: > I'm not sure if this is worth documenting, but pg_dumping mixed-case tables > with the '-t table' option appears to not be accurately documented for cmd.exe. > Here are my four attempts, with only the last as success: > > Intuitive (supplying "My Table" like "My Database"), but not correct: > C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t "My Table" > "My Database" > pg_dump: No matching tables were found > > As documented in last example at http://www.postgresql.org/docs/9.1/static/ > app-pgdump.html > C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t '"My > Table"' "My Database" > pg_dump: No matching tables were found > > Escaping quotes, but using single quotes: > C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t '\"My > Table\"' "My Database" > pg_dump: too many command-line arguments (first is "My Database") > > Escaping quotes, but using double quotes: > C:\>"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -t "\"My > Table\"" "My Database" > > works! Good point. Docs updated with attached patch, and patched to 9.3 beta as well. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --qcHopEYAB45HaUaB Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="quote.diff" diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml new file mode 100644 index 2b5e95b..1ed5e4f *** a/doc/src/sgml/ref/pg_dump.sgml --- b/doc/src/sgml/ref/pg_dump.sgml *************** CREATE DATABASE foo WITH TEMPLATE templa *** 1224,1230 **** like ! $ pg_dump -t '"MixedCaseName"' mydb > mytab.sql --- 1224,1230 ---- like ! $ pg_dump -t "\"MixedCaseName\"" mydb > mytab.sql --qcHopEYAB45HaUaB Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --qcHopEYAB45HaUaB--