Subject: pg_dump -t broken for mixed case table names in beta3?

From: "Kevin Grittner" <[email-masked]>
Date: Tue, 28 Nov 2006 13:27:55 -0600

Unless I'm missing something, pg_dump is not allowing selective dump of
a table where the table name is mixed case.  The -t switch still works
for lower case.  Even though quotes weren't previously needed on the
pg_dump command line, I tried that with no better luck.
 
postgres@DTR3:~> psql dtr
Welcome to psql 8.2beta3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

dtr=# \d "DbTranLogRecord"
         Table "public.DbTranLogRecord"
     Column     |       Type        | Modifiers
----------------+-------------------+-----------
 countyNo       | "CountyNoT"       | not null
 tranImageSeqNo | "TranImageSeqNoT" | not null
 logRecordSeqNo | "LogRecordSeqNoT" | not null
 operation      | "OperationT"      | not null
 tableName      | "TableNameT"      | not null
Indexes:
    "DbTranLogRecordPK" PRIMARY KEY, btree ("countyNo",
"tranImageSeqNo", "logRecordSeqNo")
    "DbTranLogRecord_tableName" btree ("countyNo", "tableName",
operation)

dtr=# \q
postgres@DTR3:~> pg_dump -s -t DbTranLogRecord dtr
pg_dump: No matching tables were found
postgres@DTR3:~>

---

From: Tom Lane <[email-masked]>
Date: Tue, 28 Nov 2006 14:43:17 -0500

"Kevin Grittner" <[email-masked]> writes:
> a table where the table name is mixed case.

You do it like this:

	$ pg_dump -s -t '"DbTranLogRecord"' dtr

A bit ugly but the conflict between shell and SQL quoting rules
sometimes forces us into compromises :-(

Perhaps it's worth having an example for this in the pg_dump man page?

			regards, tom lane

---

From: "Kevin Grittner" <[email-masked]>
Date: Tue, 28 Nov 2006 13:49:31 -0600

Thanks much; it might have been a while before I tried that nested
quoting technique.  I think it's worth documenting.  Would you like me
to try to put a doc patch together, or would it be better for someone
else to do so?
 
-Kevin

>>> Tom Lane <[email-masked]> 11/28/06 1:43 PM >>> 

You do it like this:

	$ pg_dump - s - t '"DbTranLogRecord"' dtr

A bit ugly but the conflict between shell and SQL quoting rules
sometimes forces us into compromises :- (

			regards, tom lane

---

From: David Fetter <[email-masked]>
Date: Tue, 28 Nov 2006 14:51:09 -0800

> Perhaps it's worth having an example for this in the pg_dump man page?

Please find enclosed a patch which adds this :)

Cheers,
D
-- 
David Fetter <[email-masked]> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!
Index: doc/src/sgml/ref/pg_dump.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.91
diff -c -r1.91 pg_dump.sgml
*** doc/src/sgml/ref/pg_dump.sgml	23 Oct 2006 18:10:32 -0000	1.91
--- doc/src/sgml/ref/pg_dump.sgml	28 Nov 2006 22:50:15 -0000
***************
*** 805,810 ****
--- 805,818 ----
    </para>
  
    <para>
+    To dump a single table named <literal>camelCaseTable</>:
+ 
+ <screen>
+ <prompt>$</prompt> <userinput>pg_dump -t '"camelCaseTable"' mydb &gt; db.sql</userinput>
+ </screen>
+   </para>
+ 
+   <para>
     To dump all tables whose names start with <literal>emp</> in the
     <literal>detroit</> schema, except for the table named
     <literal>employee_log</literal>:

---

From: Tom Lane <[email-masked]>
Date: Tue, 28 Nov 2006 17:54:55 -0500

> Please find enclosed a patch which adds this :)

Already done, thanks.

			regards, tom lane