Warning: dbexport can't handle a column named current
Posted in 1997
Hi Family,
I ran a dbexport on an AIX machine (OnLine 7.1x) and produced the
necessary directory, which I TAR'd, gzip'd, and FTP'd to a new machine
intended to run SE 7.2.
Aside from the expected conflicts with indexes (some are over 8 columns)
I just ran into a nasty:
Hi Family.
My most recent dbimport failed with the following message (the create
table is shortened for clarity):
create table "garpac".zzragedr
(
company char(2),
customer char(5),
division char(1),
rec_type char(2),
future decimal(11,2),
current decimal(11,2),...
) ;
*** put loadcur
1213 - Character to numeric conversion error
Looking at the corresponding UNL file, I see the cause of the problem.
Here is the [shortened] first line of the UNL file:
01|RET00|2|NT|0.0|1997-11-10 07:31:22.000|
Say, that looks like a datetime, not a decimal!
Yet, in the original data the column really *is* dacimal.
Then I noticed that that 6th column in the UNL file is the string:
1997-11-10 07:31:22.000
the whole way down! This reflects the time I ran the dbexport.
Wohoppen?
I see the name of the column is "current", a reserved word in older
versions of the product. Apparently, dbexport used the column name in
its generated SQL requesting that the engine select col1, col2..,
current.. from the the table. And so it did, interpreting the word
current as the SQL built-in datetime function "current" rather than as
the column name.
I note that the UNLOAD command (using select *) makes no such mistake. I
suspect that if dbexport were using SELECT * it would not make this
mistake either.
My expected workaround was to:
- Edit the SQL file, rename that column "xxcurrent".
- Let the dbimport go on to completion.
- RENAME COLUMN to current.
However, the unl is already screwed up with that datetime data. It
looks like I may have to start the dbexport all over again but first
obtain an ordinary unload (select *) from this one table and use that
data to replace the dbexport-generated unl file. (Can't do that now -
the original table has 1500 more rows than when I did the dbexport. I
don't know all the interrelations among the tables.)
Any comments? Known bugs? Flames at my group for using the column name
"current" in the first place? That last one would be unfair, since it
is not a reserved word. I claim this is a bug in dbexport, seldom
encountered because most people have the good sense to be paranoid about
formerly reserved words. :-))
--
-- Jake (Never yelled "CROWDED THEATER!" during a fire)
+------------------------------------------------------------+
| The expedient performance of a task with excessive concern |
| regarding its duration-to-completion engenders a virtual |
| certainty of diminished benefit therefrom. |
| -- Benjamin Franklin (but he said it in 3 words) |
+------------------------------------------------------------+