Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
pg_dump: Fix dumping of WITH OIDS tables
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 9 Nov 2018 08:17:25 +0000 (09:17 +0100)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 13 Nov 2018 08:41:34 +0000 (09:41 +0100)
A table with OIDs that was the first in the dump output would not get
dumped with OIDs enabled.  Fix that.

The reason was that the currWithOids flag was declared to be bool but
actually also takes a -1 value for "don't know yet".  But under
stdbool.h semantics, that is coerced to true, so the required SET
default_with_oids command is not output again.  Change the variable
type to char to fix that.

Reported-by: Derek Nelson <derek@pipelinedb.com>
src/bin/pg_dump/pg_backup_archiver.h

index 8dd19159989ccf5f4fbae700660ce88239e6ef5f..7d533666352f13b526988b7cdc345f33b934e7d1 100644 (file)
@@ -346,7 +346,8 @@ struct _archiveHandle
    char       *currUser;       /* current username, or NULL if unknown */
    char       *currSchema;     /* current schema, or NULL */
    char       *currTablespace; /* current tablespace, or NULL */
-   bool        currWithOids;   /* current default_with_oids setting */
+   char        currWithOids;   /* current default_with_oids setting: true,
+                                * false, or -1 for unknown, forcing a SET */
 
    void       *lo_buf;
    size_t      lo_buf_used;