aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-03-20 07:05:21 +0000
committerBruce Momjian <bruce@momjian.us>2003-03-20 07:05:21 +0000
commitcf4cee1b17d71f59efb0b47c79357e102f542257 (patch)
tree01b3ecdd463cf73bc597ba4993f1abac0ac6326f
parent5f65225fa37bd244ee5487448ac542b2b2f47296 (diff)
downloadpostgresql-cf4cee1b17d71f59efb0b47c79357e102f542257.tar.gz
postgresql-cf4cee1b17d71f59efb0b47c79357e102f542257.zip
At present, dates are put into a dump in the format specified by the
default datestyle. This is not portable between installations. This patch sets DATESTYLE to ISO at the start of a pg_dump, so that the dates written into the dump will be restorable onto any database, regardless of how its default datestyle is set. Oliver Elphick
-rw-r--r--src/bin/pg_dump/pg_dump.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 0c67b113bfd..d51f5f544da 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.321 2003/03/20 06:26:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.322 2003/03/20 07:05:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -548,6 +548,13 @@ main(int argc, char **argv)
PQerrorMessage(g_conn));
PQclear(res);
+ /* Set the datestyle to ISO to ensure the dump's portability */
+ res = PQexec(g_conn, "SET DATESTYLE = ISO");
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
+ exit_horribly(g_fout, NULL, "could not set datestyle to ISO: %s",
+ PQerrorMessage(g_conn));
+ PQclear(res);
+
/*
* If supported, set extra_float_digits so that we can dump float data
* exactly (given correctly implemented float I/O code, anyway)