Skip site navigation (1) Skip section navigation (2)

BUG #4957: search_path and pg_dump -T switch

From: "Maxim(dot)Boguk" <maxim(dot)boguk(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4957: search_path and pg_dump -T switch
Date: 2009-07-31 10:31:52
Message-ID: 200907311031.n6VAVqQw012664@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      4957
Logged by:          Maxim.Boguk
Email address:      maxim(dot)boguk(at)gmail(dot)com
PostgreSQL version: 8.3
Operating system:   Any
Description:        search_path and pg_dump -T switch
Details: 

If table lies outside of database search path
pg_dump -T table will dump this table contents/structure.

(i found that bug when i creating custom backup plan for complicated db).

Test case:

empty DB:

pgsql(at)[local] postgres=#CREATE schema test;
CREATE SCHEMA
pgsql(at)[local] postgres=#CREATE TABLE test.test1 (id serial);
CREATE TABLE
pgsql(at)[local] postgres=#CREATE TABLE test2 (id serial);
CREATE TABLE
pgsql(at)[local] postgres=#INSERT into test.test1 values (1);
INSERT 0 1
pgsql(at)[local] postgres=#INSERT into test2 values (1);
INSERT 0 1

Now we have table test1 with one row outside of search_path and table test2
with one row inside of search path.

Now 
pg_dump -F p -D -T test1 -a test_db | grep test1
will out:
INSERT INTO test1 (id) VALUES (1);

And
pg_dump -F p -D -T test2 -a test_db | grep test2
will out empty.

First result is wrong.

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-07-31 13:59:43
Subject: Re: BUG #4957: search_path and pg_dump -T switch
Previous:From: Alvaro HerreraDate: 2009-07-31 03:15:55
Subject: Re: Fwd: BUG #4953: Crash with xml functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group