pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15983: pg_dump converts CRLF to LF
3+ messages / 3 participants
[nested] [flat]
* BUG #15983: pg_dump converts CRLF to LF
@ 2019-08-29 14:07 PG Bug reporting form <noreply@postgresql.org>
2019-08-29 14:33 ` Re: BUG #15983: pg_dump converts CRLF to LF Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2019-08-29 14:07 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: james.inform@pharmapp.de
The following bug has been logged on the website:
Bug reference: 15983
Logged by: James Inform
Email address: james.inform@pharmapp.de
PostgreSQL version: 11.5
Operating system: Mac / Linux
Description:
When using "pg_dump --inserts" to generate insert statements in my dump
file, all line feeds (LF and CRLF) in e.g. text fields are converted to
LF.
After importing the dump file using psql, all CRLF are gone and I have LF
everywhere. So in fact pg_dump -> psql for backup/restore changes my data.
This way I am loosing information that is necessary for applications that
expect CRLF and not LF in the data they get from PostgreSQL.
Btw. when not using --inserts in pg_dump then everything works fine and \r\n
is used in the copy command for CRLF.
So, I think we have to opportunities:
1. Fix this behaviour for --inserts option
2. State the behaviour in the manual, so that it is clear for every user.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #15983: pg_dump converts CRLF to LF
2019-08-29 14:07 BUG #15983: pg_dump converts CRLF to LF PG Bug reporting form <noreply@postgresql.org>
@ 2019-08-29 14:33 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2019-08-29 14:33 UTC (permalink / raw)
To: james.inform@pharmapp.de; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> When using "pg_dump --inserts" to generate insert statements in my dump
> file, all line feeds (LF and CRLF) in e.g. text fields are converted to
> LF.
Can't reproduce that here: the dump is correctly re-imported when
I read it in psql, either with \i or with "-f".
In the --inserts form, the newlines are just going to appear verbatim
in the dump file, so they are very vulnerable to *other* tools deciding
to convert them, and I speculate that that's what happened to your file.
We could protect against that perhaps by dumping such strings using
E'...\r\n...', but that would be entirely unportable to other DBMSes.
Since the only real use-case for --inserts mode (IMO anyway) is to
transfer data to other DBMSes, that doesn't seem like a win.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* [PATCH v1 1/1] basic_archive: Allow archive directory to be missing at startup.
@ 2026-02-11 21:10 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 3+ messages in thread
From: Nathan Bossart @ 2026-02-11 21:10 UTC (permalink / raw)
---
contrib/basic_archive/basic_archive.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/contrib/basic_archive/basic_archive.c b/contrib/basic_archive/basic_archive.c
index 6c7f985d48b..8c7e9be624f 100644
--- a/contrib/basic_archive/basic_archive.c
+++ b/contrib/basic_archive/basic_archive.c
@@ -90,13 +90,11 @@ _PG_archive_module_init(void)
/*
* check_archive_directory
*
- * Checks that the provided archive directory exists.
+ * Checks that the provided archive directory path isn't too long.
*/
static bool
check_archive_directory(char **newval, void **extra, GucSource source)
{
- struct stat st;
-
/*
* The default value is an empty string, so we have to accept that value.
* Our check_configured callback also checks for this and prevents
@@ -115,17 +113,6 @@ check_archive_directory(char **newval, void **extra, GucSource source)
return false;
}
- /*
- * Do a basic sanity check that the specified archive directory exists. It
- * could be removed at some point in the future, so we still need to be
- * prepared for it not to exist in the actual archiving logic.
- */
- if (stat(*newval, &st) != 0 || !S_ISDIR(st.st_mode))
- {
- GUC_check_errdetail("Specified archive directory does not exist.");
- return false;
- }
-
return true;
}
--
2.50.1 (Apple Git-155)
--pz+mDfPuC3M6Tm7Q--
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-02-11 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 14:07 BUG #15983: pg_dump converts CRLF to LF PG Bug reporting form <noreply@postgresql.org>
2019-08-29 14:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-02-11 21:10 [PATCH v1 1/1] basic_archive: Allow archive directory to be missing at startup. Nathan Bossart <nathan@postgresql.org>
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