File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 12
12
* by PostgreSQL
13
13
*
14
14
* IDENTIFICATION
15
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.362 2004/01/07 00:44:21 tgl Exp $
15
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.363 2004/01/22 19:09:32 tgl Exp $
16
16
*
17
17
*-------------------------------------------------------------------------
18
18
*/
@@ -1149,12 +1149,19 @@ dumpDatabase(Archive *AH)
1149
1149
}
1150
1150
else
1151
1151
{
1152
+ /*
1153
+ * In 7.0, datpath is either the same as datname, or the user-given
1154
+ * location with "/" and the datname appended. We must strip this
1155
+ * junk off to produce a correct LOCATION value.
1156
+ */
1152
1157
appendPQExpBuffer (dbQry , "SELECT "
1153
1158
"(SELECT oid FROM pg_class WHERE relname = 'pg_database') AS tableoid, "
1154
1159
"oid, "
1155
1160
"(SELECT usename FROM pg_user WHERE usesysid = datdba) as dba, "
1156
1161
"pg_encoding_to_char(encoding) as encoding, "
1157
- "datpath "
1162
+ "CASE WHEN length(datpath) > length(datname) THEN "
1163
+ "substr(datpath,1,length(datpath)-length(datname)-1) "
1164
+ "ELSE '' END as datpath "
1158
1165
"FROM pg_database "
1159
1166
"WHERE datname = " );
1160
1167
appendStringLiteral (dbQry , datname , true);
Original file line number Diff line number Diff line change 6
6
* Portions Copyright (c) 1994, Regents of the University of California
7
7
*
8
8
*
9
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.29 2003/11/29 19:52:05 pgsql Exp $
9
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.30 2004/01/22 19:09:32 tgl Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -430,14 +430,22 @@ dumpCreateDB(PGconn *conn)
430
430
else
431
431
{
432
432
/*
433
+ * In 7.0, datpath is either the same as datname, or the user-given
434
+ * location with "/" and the datname appended. We must strip this
435
+ * junk off to produce a correct LOCATION value.
436
+ *
433
437
* Note: 7.0 fails to cope with sub-select in COALESCE, so just
434
438
* deal with getting a NULL by not printing any OWNER clause.
435
439
*/
436
440
res = executeQuery (conn ,
437
441
"SELECT datname, "
438
442
"(select usename from pg_shadow where usesysid=datdba), "
439
443
"pg_encoding_to_char(d.encoding), "
440
- "'f' as datistemplate, datpath, '' as datacl "
444
+ "'f' as datistemplate, "
445
+ "CASE WHEN length(datpath) > length(datname) THEN "
446
+ "substr(datpath,1,length(datpath)-length(datname)-1) "
447
+ "ELSE '' END as datpath, "
448
+ "'' as datacl "
441
449
"FROM pg_database d "
442
450
"ORDER BY 1" );
443
451
}
You can’t perform that action at this time.
0 commit comments