No title

Started by Christopher Kings-Lynnealmost 23 years ago5 messages
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

Hi,

In postgresql 7.3.1, if I do pg_dumpall -c, at the top of the dump file is
this:

DROP DATABASE au_shipping
;CREATE DATABASE au_shipping WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE au_test
;CREATE DATABASE au_test WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE australia
;CREATE DATABASE australia WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE geeklog
;CREATE DATABASE geeklog WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE keystone
;CREATE DATABASE keystone WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';

Why are all the CREATE DATABASE statements commented out? Surely that will
make the restore fail?

Chris

#2Devrim GUNDUZ
devrim@tr.net
In reply to: Christopher Kings-Lynne (#1)
Re:

Hi,

On Thu, 2003-01-16 at 10:13, Christopher Kings-Lynne wrote:

In postgresql 7.3.1, if I do pg_dumpall -c, at the top of the dump file is
this:

DROP DATABASE au_shipping
;CREATE DATABASE au_shipping WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE au_test
;CREATE DATABASE au_test WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE australia
;CREATE DATABASE australia WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE geeklog
;CREATE DATABASE geeklog WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE keystone
;CREATE DATABASE keystone WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';

Why are all the CREATE DATABASE statements commented out? Surely that will
make the restore fail?

Just guessing:

The first line does not have a ; at the end; so the first semicolon (at
the beginning of second line) will end the first line; will not comment
the CREATE DATABASE line...

I mean, it might work as below:
DROP DATABASE au_shipping;

CREATE DATABASE au_shipping WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';

?

Best regards,
--
Devrim GUNDUZ
TR.NET Sistem Destek Uzmani

Tel : (312) 295 93 18 Fax : (312) 295 94 94 Tel : (216) 542 90 00

#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Devrim GUNDUZ (#2)
1 attachment(s)
Re:

You're right. It's a type in pg_dumpall.c

I have attached a fix for it.

Chris

Show quoted text

;CREATE DATABASE keystone WITH OWNER = chriskl TEMPLATE =

template0 ENCODING

= 'SQL_ASCII';

Why are all the CREATE DATABASE statements commented out?

Surely that will

make the restore fail?

Just guessing:

The first line does not have a ; at the end; so the first semicolon (at
the beginning of second line) will end the first line; will not comment
the CREATE DATABASE line...

I mean, it might work as below:
DROP DATABASE au_shipping;

CREATE DATABASE au_shipping WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';

Attachments:

pg_dumpall.txttext/plain; name=pg_dumpall.txtDownload
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.12
diff -c -r1.12 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c	2003/01/06 18:53:25	1.12
--- src/bin/pg_dump/pg_dumpall.c	2003/01/16 08:41:49
***************
*** 397,403 ****
  		buf = createPQExpBuffer();
  
  		if (output_clean)
! 			appendPQExpBuffer(buf, "DROP DATABASE %s\n;", fmtId(dbname));
  
  		appendPQExpBuffer(buf, "CREATE DATABASE %s", fmtId(dbname));
  		appendPQExpBuffer(buf, " WITH OWNER = %s TEMPLATE = template0", fmtId(dbowner));
--- 397,403 ----
  		buf = createPQExpBuffer();
  
  		if (output_clean)
! 			appendPQExpBuffer(buf, "DROP DATABASE %s;\n", fmtId(dbname));
  
  		appendPQExpBuffer(buf, "CREATE DATABASE %s", fmtId(dbname));
  		appendPQExpBuffer(buf, " WITH OWNER = %s TEMPLATE = template0", fmtId(dbowner));
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kings-Lynne (#3)
Re:

"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:

You're right. It's a type in pg_dumpall.c

A harmless typo --- the lines aren't "commented out" (I think your
assembly-language background is showing ;-)). But it is pretty ugly
output all the same. Have applied the patch.

regards, tom lane

#5mlw
pgsql@mohawksoft.com
In reply to: Christopher Kings-Lynne (#1)
Re:

I don't think a semicolon is a comment. It causes the execution of the
previous statement.

Christopher Kings-Lynne wrote:

Show quoted text

Hi,

In postgresql 7.3.1, if I do pg_dumpall -c, at the top of the dump file is
this:

DROP DATABASE au_shipping
;CREATE DATABASE au_shipping WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE au_test
;CREATE DATABASE au_test WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE australia
;CREATE DATABASE australia WITH OWNER = auadmin TEMPLATE = template0
ENCODING = 'SQL_ASCII';
DROP DATABASE geeklog
;CREATE DATABASE geeklog WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';
DROP DATABASE keystone
;CREATE DATABASE keystone WITH OWNER = chriskl TEMPLATE = template0 ENCODING
= 'SQL_ASCII';

Why are all the CREATE DATABASE statements commented out? Surely that will
make the restore fail?

Chris

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly