Skip to content

Commit cf4cee1

Browse files
committed
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
1 parent 5f65225 commit cf4cee1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.321 2003/03/20 06:26:30 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.322 2003/03/20 07:05:21 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -548,6 +548,13 @@ main(int argc, char **argv)
548548
PQerrorMessage(g_conn));
549549
PQclear(res);
550550

551+
/* Set the datestyle to ISO to ensure the dump's portability */
552+
res = PQexec(g_conn, "SET DATESTYLE = ISO");
553+
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
554+
exit_horribly(g_fout, NULL, "could not set datestyle to ISO: %s",
555+
PQerrorMessage(g_conn));
556+
PQclear(res);
557+
551558
/*
552559
* If supported, set extra_float_digits so that we can dump float data
553560
* exactly (given correctly implemented float I/O code, anyway)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy