Re: timestamps - Mailing list pgsql-novice

From Steven Klassen
Subject Re: timestamps
Date
Msg-id 20041214163511.GA21117@commandprompt.com
Whole thread Raw
In response to timestamps  (Martin Atukunda <matlads@myrealbox.com>)
Responses Re: timestamps  (Martin Atukunda <matlads@myrealbox.com>)
List pgsql-novice
# The schema for translog is as follows:
#
# CREATE TABLE translog (
#  id serial,
#  action integer,
#  sdate varchar(16) NOT NULL,
#  stime varchar(16) NOT NULL
# );

I assume you mean the composite sdate/stime is 1 minute ago?

Instead of storing separate date & time varchar fields, why don't you
store one timestamp field?  Then a query like this would work:

SELECT * FROM translog WHERE start <= (now() - '1 minute'::interval);

--
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] timestamps
Next
From: Afton & Ray Still
Date:
Subject: Re: basic download and setup questions