diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-18 01:29:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-18 01:29:10 +0000 |
commit | c0d5be5d6a736d2ee8141e920bc3de8e001bf6d9 (patch) | |
tree | f46f456a6b66217164dae1cbc36f975bd9679a00 /src/bin/pg_dump/pg_backup_null.c | |
parent | 2b44d74dd4caa0d5cec2aeb0ceec7923b69109d3 (diff) | |
download | postgresql-c0d5be5d6a736d2ee8141e920bc3de8e001bf6d9.tar.gz postgresql-c0d5be5d6a736d2ee8141e920bc3de8e001bf6d9.zip |
Fix up pg_dump's treatment of large object ownership and ACLs. We now emit
a separate archive entry for each BLOB, and use pg_dump's standard methods
for dealing with its ownership, ACL if any, and comment if any. This means
that switches like --no-owner and --no-privileges do what they're supposed
to. Preliminary testing says that performance is still reasonable even
with many blobs, though we'll have to see how that shakes out in the field.
KaiGai Kohei, revised by me
Diffstat (limited to 'src/bin/pg_dump/pg_backup_null.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_null.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_null.c index 127ff572197..35b9a18a4ed 100644 --- a/src/bin/pg_dump/pg_backup_null.c +++ b/src/bin/pg_dump/pg_backup_null.c @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.23 2009/12/14 00:39:11 itagaki Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.24 2010/02/18 01:29:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -147,14 +147,21 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te) static void _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid) { + bool old_blob_style = (AH->version < K_VERS_1_12); + if (oid == 0) die_horribly(AH, NULL, "invalid OID for large object\n"); - if (AH->ropt->dropSchema) + /* With an old archive we must do drop and create logic here */ + if (old_blob_style && AH->ropt->dropSchema) DropBlobIfExists(AH, oid); - ahprintf(AH, "SELECT pg_catalog.lo_open(pg_catalog.lo_create('%u'), %d);\n", - oid, INV_WRITE); + if (old_blob_style) + ahprintf(AH, "SELECT pg_catalog.lo_open(pg_catalog.lo_create('%u'), %d);\n", + oid, INV_WRITE); + else + ahprintf(AH, "SELECT pg_catalog.lo_open('%u', %d);\n", + oid, INV_WRITE); AH->WriteDataPtr = _WriteBlobData; } |