Re: Very strange SQL problem
Posted in 1998
KPonn wrote:
> >> ^Ms. But I don't think we need to put a | at the end to indicate
> >> end of row although it probably doesn't hurt to include one.
> >
> >Informix DOES expect the | at the end of each line...no thinking
> >required! (If only!)
> >Steve
>
> I don't have to think. You DO NOT need a | at the end of each row
> for Informix 7.13 UC2. Try it !!!
>
> Keith
At various times, depending on version, the final delimiter has been
optional and mandatory. The last time I tried omitting it, it did not
work, so I've been including it religously for the last 5 years and
more. I was not aware that it had been relaxed again, but I wouldn't
exploit the laxity in a program generating unloaded data for reasons of
portability -- the data won't necessarily port to other versions.
Can anybody undertake to start a list of versions for which the
following Bourne/Korn shell script works?
tmp=${TMPDIR:-/tmp}/xx.$$
trap "rm -f $tmp; exit 1" 0 1 2 3 13 15
echo "1" > $tmp
isql ${DATABASE:-stores} - <<!
create temp table test_load_cmd (i integer);
load from "$tmp" insert into test_load_cmd;!
rm -f $tmp
trap 0
exit 0
You have to monitor the output, but it should report that the table was
created and 1 row was loaded if the delimiter is not needed, but it
should report that the table was created and an error occurred if the
delimiter is necessary. I'd expect most versions from 4.00 through to
6.0x to fail. I reserve judgement on the 7.x versions because I would
expect them to fail, but we have an assertion that 7.13.UC2 on at least
one (unidentified) platform will accept this.
Yours,
Jonathan Leffler (jleffler@earthlink.net) #include <many-aliases.h>
PS: No, I really don't want to have to collate the results -- my son was
born on the 23rd, and I'm only doing this now because both he and my
wife are asleep.
PPS: Versions 2.10.03X and earlier allowed you to omit the final
delimiter; indeed, they may even have required it to be omitted.
Needing the final delimiter was one of many changes which occurred with
the 4.00 release, which also introduced blobs and VARCHAR and opened up
the possibility of multi-line character strings. The newlines embedded
in a character field need to be escaped with a backslash when the data
is loaded.