pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedBad Date field
4+ messages / 4 participants
[nested] [flat]
* Bad Date field
@ 2001-11-29 16:42 Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>
0 siblings, 3 replies; 4+ messages in thread
From: Peralta Miguel-MPERALT1 @ 2001-11-29 16:42 UTC (permalink / raw)
To: pgsql-admin
Hello everyone:
Would anyone know how to find a bad date field in an external file? I have
an external file that I am using to populate a table using the following
command:
COPY release_data FROM '/home/mperalta/release_data' USING DELIMITERS '|'
When I issue this command, the response afte a while is the following:
ERROR; Bad date external representation '9'
The external file is rather large and I've tried finding this bad date
manually with no success. The table I'm copying into has a datestamp of
type DATE.
Any suggestions would be greatly appreciated.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Bad Date field
@ 2001-11-29 17:01 DHSC Webmaster <webmaster@dhs-club.com>
parent: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>
2 siblings, 0 replies; 4+ messages in thread
From: DHSC Webmaster @ 2001-11-29 17:01 UTC (permalink / raw)
To: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>; +Cc: pgsql-admin
You could use a perl script to read your data and do a pattern match for
consistency with your date output. Or you could import the data into a
temp table which has a text field instead of date. You could query
against your temp table to find offending data. Then use SQL to insert
the data into your real table.
Peralta Miguel-MPERALT1 wrote:
>
> Hello everyone:
>
> Would anyone know how to find a bad date field in an external file? I have
> an external file that I am using to populate a table using the following
> command:
> COPY release_data FROM '/home/mperalta/release_data' USING DELIMITERS '|'
>
> When I issue this command, the response afte a while is the following:
>
> ERROR; Bad date external representation '9'
>
> The external file is rather large and I've tried finding this bad date
> manually with no success. The table I'm copying into has a datestamp of
> type DATE.
>
> Any suggestions would be greatly appreciated.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Bill MacArthur
Webmaster
DHS Club
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Bad Date field
@ 2001-11-29 17:08 bangh <banghe@baileylink.net>
parent: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>
2 siblings, 0 replies; 4+ messages in thread
From: bangh @ 2001-11-29 17:08 UTC (permalink / raw)
To: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>; +Cc: pgsql-admin
Suggest:
create another table, use text, instead of date type for that filed. AFter you
get imported and fix invalid data for that filed, in pgsql, you can convert it
to date type
In pgsql, this is easy to find those invalid data.
Bangh
Peralta Miguel-MPERALT1 wrote:
> Hello everyone:
>
> Would anyone know how to find a bad date field in an external file? I have
> an external file that I am using to populate a table using the following
> command:
> COPY release_data FROM '/home/mperalta/release_data' USING DELIMITERS '|'
>
> When I issue this command, the response afte a while is the following:
>
> ERROR; Bad date external representation '9'
>
> The external file is rather large and I've tried finding this bad date
> manually with no success. The table I'm copying into has a datestamp of
> type DATE.
>
> Any suggestions would be greatly appreciated.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Bad Date field
@ 2001-11-29 18:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2001-11-29 18:32 UTC (permalink / raw)
To: Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>; +Cc: pgsql-admin
Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com> writes:
> COPY release_data FROM '/home/mperalta/release_data' USING DELIMITERS '|'
> When I issue this command, the response afte a while is the following:
> ERROR; Bad date external representation '9'
> The external file is rather large and I've tried finding this bad date
> manually with no success.
How old is your Postgres? The last several releases include line
numbers when complaining about COPY problems.
In the meantime, I like the other person's suggestion about importing
into a temp table and then working with the temp table to clean up
the data.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-11-29 18:32 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-29 16:42 Bad Date field Peralta Miguel-MPERALT1 <Miguel.Peralta@motorola.com>
2001-11-29 17:01 ` DHSC Webmaster <webmaster@dhs-club.com>
2001-11-29 17:08 ` bangh <banghe@baileylink.net>
2001-11-29 18:32 ` Tom Lane <tgl@sss.pgh.pa.us>
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