The following bug has been logged online:
Bug reference: 5560
Logged by: Shigeru Hanada
Email address: hanada@metrosystems.co.jp
PostgreSQL version: 9.1devel
Operating system: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Description: pg_dump generates invalid DDL
Details:
When target database contains user mapping for public, pg_dump generates
invalid DDL with empty string like this.
CREATE USER MAPPING FOR "" SERVER srv;
This DDL causes error below.
ERROR: zero-length delimited identifier at or near """" at character 25
STATEMENT: CREATE USER MAPPING FOR "" SERVER srv;
How to reproduce:
psql<<EOF
CREATE FOREIGN DATA WRAPPER fdw;
CREATE SERVER srv FOREIGN DATA WRAPPER fdw;
CREATE USER MAPPING FOR PUBLIC SERVER srv;
EOF
pg_dump > mapping.sql
createdb newdb
psql -f mapping.sql newdb