| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
|---|---|
| To: | Kris Jurka <books(at)ejurka(dot)com> |
| Cc: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
| Subject: | Re: [BUGS] COPY allows parameters which corrupt output |
| Date: | 2004-04-06 13:21:59 |
| Message-ID: | 200404061321.i36DLxL14289@candle.pha.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-patches |
Kris Jurka wrote:
>
> COPY allows DELIMITER and NULL to be specified which don't allow the data
> to be copied back in properly. Using any delimiter that could be part of
> a backslash escape sequence (\n \0 \t) will break if any of the data has a
> character matching the delimiter because it will be escaped and then be
> read as a special character.
>
> It also allows DELIMITER and NULL to overlap. No character in the NULL
> specification should be the DELIMITER.
The attached applied patch throws an error if the delimiter appears in
the COPY NULL string:
test=> copy pg_language to '/tmp/x' with delimiter '|';
COPY
test=> copy pg_language to '/tmp/x' with delimiter '|' null '|x';
ERROR: COPY delimiter must not appear in the NULL specification
test=> copy pg_language from '/tmp/x' with delimiter '|' null '|x';
ERROR: COPY delimiter must not appear in the NULL specification
It also throws an error if it conflicts with the default NULL string:
test=> copy pg_language to '/tmp/x' with delimiter '\\';
ERROR: COPY delimiter must not appear in the NULL specification
test=> copy pg_language to '/tmp/x' with delimiter '\\' NULL 'x';
COPY
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
| Attachment | Content-Type | Size |
|---|---|---|
| unknown_filename | text/plain | 838 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2004-04-06 13:37:17 | Re: BUG #1128: horology tests fails while make check (7.4.2) |
| Previous Message | SZŰCS Gábor | 2004-04-06 13:12:46 | could not devise a query plan |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2004-04-06 13:39:10 | Re: WIN32 psql Ctrl+C support |
| Previous Message | Andrew Dunstan | 2004-04-06 12:59:14 | Re: [HACKERS] logging statement levels |