pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17630: pg_dump error
3+ messages / 3 participants
[nested] [flat]

* BUG #17630: pg_dump error
@ 2022-10-09 09:22  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2022-10-09 09:22 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: killerwzb@163.com

The following bug has been logged on the website:

Bug reference:      17630
Logged by:          camel
Email address:      killerwzb@163.com
PostgreSQL version: 14.5
Operating system:   centos7
Description:        

Hi guys:
    I create table with a upper name ,it is "TABLE2" .I use pg_dump to dump
the table to a custom file,but i get some error.

The first step:
[wangzhibin@localhost bin]$ ./psql -U postgres
psql (16devel)
Type "help" for help.

postgres=# create table "TABLE2" (t1 int);
CREATE TABLE

The second step:
[wangzhibin@localhost bin]$ ./pg_dump --verbose --host localhost --port 5432
--username postgres --dbname=postgres --format custom --file ~/db.bak
--table TABLE2
pg_dump: last built-in OID is 16383
pg_dump: error: no matching tables were found
[wangzhibin@localhost bin]$ ./pg_dump --verbose --host localhost --port 5432
--username postgres --dbname=postgres --format custom --file ~/db.bak
--table "TABLE2"
pg_dump: last built-in OID is 16383
pg_dump: error: no matching tables were found
[wangzhibin@localhost bin]$ ./pg_dump --verbose --host localhost --port 5432
--username postgres --dbname=postgres --format custom --file ~/db.bak
--table "table2"
pg_dump: last built-in OID is 16383
pg_dump: error: no matching tables were found



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #17630: pg_dump error
@ 2022-10-09 22:20  Christophe Pettus <xof@thebuild.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Christophe Pettus @ 2022-10-09 22:20 UTC (permalink / raw)
  To: killerwzb@163.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>



> On Oct 9, 2022, at 02:22, PG Bug reporting form <noreply@postgresql.org> wrote:
>    I create table with a upper name ,it is "TABLE2" .I use pg_dump to dump
> the table to a custom file,but i get some error.

It's not a bug, but it's kind of an annoying situation.  The double quotes on the command line just delimit the name of the table, but the shell strips them off (as you would expect), so pg_dump just gets the bare name.  You have to add separate, escaped double-quotes, since the table name requires them:

xof=# create table "TABLE2" (i integer);
CREATE TABLE
xof=# 
\q
xof$ pg_dump --dbname=xof --table "TABLE2" > /dev/null
pg_dump: error: no matching tables were found
xof$ pg_dump --dbname=xof --table "\"TABLE2\"" > /dev/null
xof$ 






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #17630: pg_dump error
@ 2022-10-09 22:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Christophe Pettus <xof@thebuild.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2022-10-09 22:53 UTC (permalink / raw)
  To: Christophe Pettus <xof@thebuild.com>; +Cc: killerwzb@163.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Christophe Pettus <xof@thebuild.com> writes:
>> On Oct 9, 2022, at 02:22, PG Bug reporting form <noreply@postgresql.org> wrote:
>> I create table with a upper name ,it is "TABLE2" .I use pg_dump to dump
>> the table to a custom file,but i get some error.

> It's not a bug, but it's kind of an annoying situation.  The double quotes on the command line just delimit the name of the table, but the shell strips them off (as you would expect), so pg_dump just gets the bare name.  You have to add separate, escaped double-quotes, since the table name requires them:

Another way with slightly fewer keystrokes is

	pg_dump ... --table '"TABLE2"'

Of course, if you're also in the habit of putting single-quotes in
your table names, that'll still need some work.  The main point is
that there are two layers of quoting that you have to deal with:
the shell's, and then SQL's.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-10-09 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 09:22 BUG #17630: pg_dump error PG Bug reporting form <noreply@postgresql.org>
2022-10-09 22:20 ` Christophe Pettus <xof@thebuild.com>
2022-10-09 22:53   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox