pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump bug
4+ messages / 3 participants
[nested] [flat]

* pg_dump bug
@ 2002-04-01 20:11  Jie Liang <jliang@beijing.rapid.stbernard.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Jie Liang @ 2002-04-01 20:11 UTC (permalink / raw)
  To: pgsql-bugs@postgresql.org; +Cc: pgsql-admin; rcrowe@stbernard.com

I have a pg_dump file which contains only schemas,
I think there is a bug, which causes function reload
fail, look at following pieces of dump file:
......
......
--
-- TOC Entry ID 212 (OID 34744710)
--
-- Name: gibson Type: TABLE Owner: jliang
--

CREATE TABLE "gibson" (
        "cid" integer,
        "code" character varying(10),
        "name" character varying(32)
);

--
-- TOC Entry ID 368 (OID 34746075)
--
-- Name: "urlsbycid" (smallint) Type: FUNCTION Owner: jliang
--

CREATE FUNCTION "urlsbycid" (smallint) RETURNS SETOF text AS '
select url from urlinfo where id = ratings_by_serial.id and
ratings_by_serial.cid = $1 order by random() limit 100;
' LANGUAGE 'sql';

--
-- TOC Entry ID 213 (OID 34752225)
--
-- Name: gibson2 Type: TABLE Owner: jliang
--

CREATE TABLE "gibson2" (
        "cid" integer,
        "code" character varying(10),
        "name" character varying(32),
        "url" text
);
......
......
--
-- TOC Entry ID 235 (OID 67353384)
--
-- Name: urlinfo Type: TABLE Owner: bob
--

CREATE TABLE "urlinfo" (
        "url" text NOT NULL,
        "id" integer NOT NULL,
        "ratedby" character varying(32),
        "ratedon" timestamp with time zone DEFAULT
"timestamp"('now'::text),
        "comments" text,
        "list" smallint,
        "pidwsr" integer,
        "refid" integer,
        Constraint "urlinfo_pkey" Primary Key ("id")
);
......
......

BUG:
CREATE FUNCTION "urlsbycid" cannot be created before
table "urlinfo" created!!!

I am using PostgreSQL-7.1.3 with pg_dump -s -f filename dbname.
I am upgrading my DB from Pg7.1.3 to Pg7.2.
This is one of problems I got.
I don't know does this bug has been fixed in Pg7.2??



Jie LIANG

Software Engineer
St. Bernard Software

16882 W. Bernardo Dr.
San Diego, CA 92127
Office:(858)524-2134

jie@stbernard.com




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

* pg_dump bug?
@ 2017-04-11 09:20  Andy Nercessian <ahnercessian@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Andy Nercessian @ 2017-04-11 09:20 UTC (permalink / raw)
  To: pgsql-admin

I wonder if anyone has experienced the problem I have with bloated pg_dump
files. This problem exists in both standard pg_dumps and --insert-columns
type pg_dumps. I am using postgresql 9.5 on Windows 7.

Each table appears to have a 'copy table_name .... from stdin..' in
multiple places (hundreds in some cases). The first copy statement appears
genuine, but the second and subsequent statements appear to be in the
middle of another copy clause between records. The outer copy clause is
sometimes from the same table, and sometimes from a different table.
Furthermore, from the existence of the number of backslashes \t, \\t, \\\\t
which are variable, it would appear as though nesting can be several levels
deep.

I'm not copying the actual data because apart from anything else, it's a
giant text file. But this is roughly what it looks like:

------------------------------------
copy bills from ....
Record 1 Column 1 \t Record 1 column 2 \t ....
Record 2 Column 2 \t Record 2 column 2 \t ...
......
copy adverts from .... < this is a nested copy statement unrelated to
bills, although occasionally it's another bills copy statement>

Record 88 Column 1 \t Record 88 Column 2 \t ...

-------------------------------------

So in the middle of one copy statement - in between the records being
copied, another one mysteriously appears and the records are duplicated.
Each record can therefore be found in each of the copy statements, and the
total number of such duplications is in the hundreds for some tables.

What could be causing this? I've made only the following observations:
1. The nested loops always occur in the same spot within the outer copy
statements (if records have not changed between dumps) and are preceded by
the exact same column of the same record in each dump.
2. It is clear that these copy statements are NOT part of any record.
3. The same behaviour exists for insert style dumps (where there is no copy
command).
4. Each copy statement includes the entire table, NOT a selection of
records from it.

In years of using pg_dump I have never come across this issue.


-- 
Andy

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

* Re: pg_dump bug?
@ 2017-04-11 10:33  Scott Mead <scottm@openscg.com>
  parent: Andy Nercessian <ahnercessian@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Scott Mead @ 2017-04-11 10:33 UTC (permalink / raw)
  To: Andy Nercessian <ahnercessian@gmail.com>; +Cc: pgsql-admin



> On Apr 11, 2017, at 05:20, Andy Nercessian <ahnercessian@gmail.com> wrote:
> 
> I wonder if anyone has experienced the problem I have with bloated pg_dump files. This problem exists in both standard pg_dumps and --insert-columns type pg_dumps. I am using postgresql 9.5 on Windows 7.
> 
> Each table appears to have a 'copy table_name .... from stdin..' in multiple places (hundreds in some cases). The first copy statement appears genuine, but the second and subsequent statements appear to be in the middle of another copy clause between records. The outer copy clause is sometimes from the same table, and sometimes from a different table. Furthermore, from the existence of the number of backslashes \t, \\t, \\\\t which are variable, it would appear as though nesting can be several levels deep.
> 
> I'm not copying the actual data because apart from anything else, it's a giant text file. But this is roughly what it looks like:
> 
> ------------------------------------
> copy bills from .... 
> Record 1 Column 1 \t Record 1 column 2 \t ....
> Record 2 Column 2 \t Record 2 column 2 \t ...
> ......
> copy adverts from .... < this is a nested copy statement unrelated to bills, although occasionally it's another bills copy statement>
> 
> Record 88 Column 1 \t Record 88 Column 2 \t ...
> 
> -------------------------------------
> 
> So in the middle of one copy statement - in between the records being copied, another one mysteriously appears and the records are duplicated. Each record can therefore be found in each of the copy statements, and the total number of such duplications is in the hundreds for some tables.
> 
> What could be causing this? I've made only the following observations:
> 1. The nested loops always occur in the same spot within the outer copy statements (if records have not changed between dumps) and are preceded by the exact same column of the same record in each dump.
> 2. It is clear that these copy statements are NOT part of any record. 
> 3. The same behaviour exists for insert style dumps (where there is no copy command).
> 4. Each copy statement includes the entire table, NOT a selection of records from it.
> 
> In years of using pg_dump I have never come across this issue. 

Is it possible that you have more than 1 pg_dump running simultaneously against the same output file?



> 
> 
> -- 
> Andy 


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



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

* Re: pg_dump bug?
@ 2017-04-11 11:01  Andy Nercessian <ahnercessian@gmail.com>
  parent: Scott Mead <scottm@openscg.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Andy Nercessian @ 2017-04-11 11:01 UTC (permalink / raw)
  To: Scott Mead <scottm@openscg.com>; +Cc: pgsql-admin

Thank you, Scott.
That was my first instinct too, so I explored it by carrying out a manually
typed pg_dump into psql. The result was identical. The reason I eventually
ruled it out is that the nested copy statements are all identically
positioned in each pg_dump. It would require some sort of asynchronous
writing on the file for this to happen, and in that event, it seems highly
improbable that the locations of all these nested statements would be
identical.
There is something even stranger. The restore works fine- i.e. there is no
evidence that the additional copy statements are actually carried out.
Given this fact, I wouldn't bother with this at all, were it not for the
fact that the pg_dump files are many many times larger than they need to be.

On Tue, Apr 11, 2017 at 1:33 PM, Scott Mead <scottm@openscg.com> wrote:

>
>
> > On Apr 11, 2017, at 05:20, Andy Nercessian <ahnercessian@gmail.com>
> wrote:
> >
> > I wonder if anyone has experienced the problem I have with bloated
> pg_dump files. This problem exists in both standard pg_dumps and
> --insert-columns type pg_dumps. I am using postgresql 9.5 on Windows 7.
> >
> > Each table appears to have a 'copy table_name .... from stdin..' in
> multiple places (hundreds in some cases). The first copy statement appears
> genuine, but the second and subsequent statements appear to be in the
> middle of another copy clause between records. The outer copy clause is
> sometimes from the same table, and sometimes from a different table.
> Furthermore, from the existence of the number of backslashes \t, \\t, \\\\t
> which are variable, it would appear as though nesting can be several levels
> deep.
> >
> > I'm not copying the actual data because apart from anything else, it's a
> giant text file. But this is roughly what it looks like:
> >
> > ------------------------------------
> > copy bills from ....
> > Record 1 Column 1 \t Record 1 column 2 \t ....
> > Record 2 Column 2 \t Record 2 column 2 \t ...
> > ......
> > copy adverts from .... < this is a nested copy statement unrelated to
> bills, although occasionally it's another bills copy statement>
> >
> > Record 88 Column 1 \t Record 88 Column 2 \t ...
> >
> > -------------------------------------
> >
> > So in the middle of one copy statement - in between the records being
> copied, another one mysteriously appears and the records are duplicated.
> Each record can therefore be found in each of the copy statements, and the
> total number of such duplications is in the hundreds for some tables.
> >
> > What could be causing this? I've made only the following observations:
> > 1. The nested loops always occur in the same spot within the outer copy
> statements (if records have not changed between dumps) and are preceded by
> the exact same column of the same record in each dump.
> > 2. It is clear that these copy statements are NOT part of any record.
> > 3. The same behaviour exists for insert style dumps (where there is no
> copy command).
> > 4. Each copy statement includes the entire table, NOT a selection of
> records from it.
> >
> > In years of using pg_dump I have never come across this issue.
>
> Is it possible that you have more than 1 pg_dump running simultaneously
> against the same output file?
>
>
>
> >
> >
> > --
> > Andy
>



-- 
Andy Nercessian
ahnercessian@gmail.com
+302109427400

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


end of thread, other threads:[~2017-04-11 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-01 20:11 pg_dump bug Jie Liang <jliang@beijing.rapid.stbernard.com>
2017-04-11 09:20 pg_dump bug? Andy Nercessian <ahnercessian@gmail.com>
2017-04-11 10:33 ` Re: pg_dump bug? Scott Mead <scottm@openscg.com>
2017-04-11 11:01   ` Re: pg_dump bug? Andy Nercessian <ahnercessian@gmail.com>

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