[syslog-ng] Database field types -- insert fails for null values
Liam Kirsher
liamk at numenet.com
Tue Mar 17 19:06:06 CET 2009
Balazs,
Well, can a default value be NULL? Would it be possible to say
something like
${lat:-NULL}
For lat/lng it definitely won't work, since 0/0 is a valid value -- but
probably one we don't want -- someplace out in the Atlantic Ocean.
Liam
Balazs Scheidler wrote:
> On Sun, 2009-03-15 at 14:40 -0700, Liam Kirsher wrote:
>
>> This worked fine for the timestamps, but there was a problem with other
>> types.
>>
>> Some of the numeric fields can have null values.
>>
>> It looks like syslog-ng doesn't translate empty strings into nulls when
>> doing the insert. Thus, the insert fails because the numeric field
>> types won't accept a string of any kind.
>>
>> For now, I can just let them be text strings, but I'd prefer to be able
>> to use numeric types and allow null values. For example, in the
>> destination below, lat and long could be float8 and pid and art_id could
>> be integers.
>>
>
> true enough, but you could perhaps use the "default value" feature of
> macro expansion, like this:
>
> ${art_id:-0}
>
> this means that if art_id is unset it'll expand to 0. Is this a solution
> to your problem?
>
>
--
Liam Kirsher
PGP: http://liam.numenet.com/pgp/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20090317/1b5c611f/attachment.htm
More information about the syslog-ng
mailing list