Converting timestamps and IP addresses - Mailing list pgsql-general

From Erwin Van de Velde
Subject Converting timestamps and IP addresses
Date
Msg-id 200402111212.17031.erwin.vandevelde@ua.ac.be
Whole thread Raw
Responses Re: Converting timestamps and IP addresses
List pgsql-general
Hi,

I'm building a central logging system for security applications as my master
thesis, but I've run into some troubles:

Different applications make database logs using different formats:
- Timestamps as timestamps or as numeric values
- IP addresses in dotted notation (aaa.bbb.ccc.ddd) or as numeric values

I'd like to convert these to the same type, so that I can compare them. Two
questions thereby:
- Is there an easy way with built-in functions? (I didn't found them)
- Can I use triggers and C-functions to reach my goal?

For the second question: in that case, all tables in my database would have
the same dataformat for timestamps and IP's, and conversion would happen at
insertion. However, there could be a data type mismatch between what stays in
the query (a numeric value for instance) and the column type in the database
(string type: dotted notation for IP): So, when are the types checked? Before
or after a trigger on INSERT? (Of course when using a TRIGGER BEFORE INSERT
:-)) I'm only wondering when type checks are executed...

If anyone has built such functions already, I'd gladly accept, and you can win
a line in my thank word ;-)

Greetings,
Erwin Van de Velde
Student of University of Antwerp,
Belgium


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: DB cache size strategies
Next
From: Andrew Sullivan
Date:
Subject: Re: DB cache size strategies