pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems Pgdump
3+ messages / 2 participants
[nested] [flat]

* Problems Pgdump
@ 2011-05-24 19:22  manuel antonio ochoa <manuel8aalfaro@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: manuel antonio ochoa @ 2011-05-24 19:22 UTC (permalink / raw)
  To: pgsql-sql

I trying to get the next one :

pg_dump -h 192.170.1.3 -U  User --format custom --inserts --verbose --file
\"/root/Desktop/$name .backup\" --table "$ESQUEMA.$Nametable" DB"

my Name table is  detalle_Inegra , and the problem is that it table alwals
sent me a message like i COULD NOT FIND THE NAME  OF TABLE

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

* Re: Problems Pgdump
@ 2011-05-24 19:26  manuel antonio ochoa <manuel8aalfaro@gmail.com>
  parent: manuel antonio ochoa <manuel8aalfaro@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: manuel antonio ochoa @ 2011-05-24 19:26 UTC (permalink / raw)
  To: pgsql-sql

sorry  I cound finish my problem.

I trying to get the next one :

pg_dump -h 192.170.1.3 -U  User --format custom --inserts --verbose --file
\"/root/Desktop/$name .backup\" --table "$ESQUEMA.$Nametable" DB"

my Name table is  detalle_Inegra , and the problem is that it table alwals
sent me a message like i COULD NOT FIND THE NAME  OF TABLE but the table
exist and

I use the logic for other tables and works fine .

What could be the problem?

thnks


2011/5/24 manuel antonio ochoa <manuel8aalfaro@gmail.com>

> I trying to get the next one :
>
> pg_dump -h 192.170.1.3 -U  User --format custom --inserts --verbose --file
> \"/root/Desktop/$name .backup\" --table "$ESQUEMA.$Nametable" DB"
>
> my Name table is  detalle_Inegra , and the problem is that it table alwals
> sent me a message like i COULD NOT FIND THE NAME  OF TABLE
>

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

* Re: Problems Pgdump
@ 2011-05-25 02:07  Craig Ringer <craig@postnewspapers.com.au>
  parent: manuel antonio ochoa <manuel8aalfaro@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Craig Ringer @ 2011-05-25 02:07 UTC (permalink / raw)
  To: manuel antonio ochoa <manuel8aalfaro@gmail.com>; +Cc: pgsql-sql

On 25/05/11 03:26, manuel antonio ochoa wrote:
> sorry  I cound finish my problem.
> 
> I trying to get the next one :
> 
> pg_dump -h 192.170.1.3 -U  User --format custom --inserts --verbose
> --file \"/root/Desktop/$name .backup\" --table "$ESQUEMA.$Nametable" DB"
> 
> my Name table is  detalle_Inegra , and the problem is that it table
> alwals sent me a message like i COULD NOT FIND THE NAME  OF TABLE but
> the table exist and

It's almost certainly a case-folding issue. It'd help if you posted the
output of:

  \d

in the database of interest.

At a guess, what's happening is that you have a mixed-case table name.
Let's say it's called "Fred". You're trying to run:

  pg_dump --table "Fred" dbname

The shell consumes the double-quotes during argument processing, so what
pg_dump actually sees is three arguments:

  --table
  Fred
  dbname

Because of case-folding rules, table names that are not double-quoted
are folded to lower-case. This means that the table names:

  Fred
  FRED
  fred
  FrEd

are all interpreted as meaning the table "fred" (lower case).

If you need to preserve case, you need to protect the double quotes from
consumption by the shell, so you send the argument "Fred" to pg_dump. In
your command line above, you would change

  --table "$ESQUEMA.$Nametable"

to

  --table "\"$ESQUEMA\".\"$Nametable\""

... adding a pair of escaped double-quotes around both the table and
schema names that the shell does NOT consume. The outer double-quotes
need to be retained in case the table or schema names contain shell
meta-characters and/or spaces.

To learn more about postgresql's case folding, see:

http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

http://sql-info.de/postgresql/postgres-gotchas.html

http://archives.postgresql.org/pgsql-hackers/2004-04/msg00818.php

--
Craig Ringer



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


end of thread, other threads:[~2011-05-25 02:07 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 19:22 Problems Pgdump manuel antonio ochoa <manuel8aalfaro@gmail.com>
2011-05-24 19:26 ` manuel antonio ochoa <manuel8aalfaro@gmail.com>
2011-05-25 02:07   ` Craig Ringer <craig@postnewspapers.com.au>

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