[KLUG Members] Postgres SQL query

Adam Tauno Williams adam at morrison-ind.com
Tue Nov 15 14:13:05 EST 2005


> I have a Postgres sql database with well over 200 tables. Almost every table
> has a datetime field in it. When I pull the data from the old MS SQL
> database and import it through a utility that was created for me it shifts
> the dates back 1 hour which causes all sorts of havoc.. The people who
> developed the utility think it is a jdbc issue but have no idea how to
> correct it. Is there a query that can find all the datetime type fields in a
> database and then advance that field 1 hour? I can do it table by table but
> was wondering if someone has more elegant way to do everything at once in
> their memory banks. If not I guess I will be working late the next coupld of
> days to get this fixed.. Otherwise thanks in advance. 

You can easily enough identify all the timestamp fields:
SELECT table_name, column_name
FROM information_schema.columns
WHERE data_type LIKE ('timestamp%')

Doing a loop for each row in a PL/SQL procedure should be simple enough.
http://www.postgresql.org/docs/8.1/interactive/plpgsql.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.kalamazoolinux.org/pipermail/members/attachments/20051115/b00e8a08/attachment.bin


More information about the Members mailing list