dbTalk Databases Forums  

Datestamps

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Datestamps in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bryan Irvine
 
Posts: n/a

Default Datestamps - 01-09-2004 , 01:45 PM






I am trying to figure out what day some things were entered into the
DB. Is there a way to do that?

--Bryan


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: Datestamps - 01-09-2004 , 02:25 PM






On Fri, Jan 09, 2004 at 11:45:17 -0800,
Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
Quote:
I am trying to figure out what day some things were entered into the
DB. Is there a way to do that?
Rows do not have timestamps associated with them. You might be able to make
some guesses using your logfile. If this is something you want for the
future you can add a timestamp field to your table and use a trigger to
keep it up to date.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
  #3  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: Datestamps - 01-09-2004 , 02:52 PM



On Fri, Jan 09, 2004 at 12:25:45 -0800,
Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
Quote:
On Fri, 2004-01-09 at 12:25, Bruno Wolff III wrote:
On Fri, Jan 09, 2004 at 11:45:17 -0800,
Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
I am trying to figure out what day some things were entered into the
DB. Is there a way to do that?

Rows do not have timestamps associated with them. You might be able to make
some guesses using your logfile. If this is something you want for the
future you can add a timestamp field to your table and use a trigger to
keep it up to date.

I do I do!

What's the best way to create a field for tracking this?
Is this in the FAQ somewhere?
I don't think there is an FAQ, but it has been discussed on the lists a
few times. You probably want to use a before trigger to set the timestamp
column to current_timestamp on inserts or updates.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



Reply With Quote
  #4  
Old   
Bryan Irvine
 
Posts: n/a

Default Re: Datestamps - 01-09-2004 , 03:12 PM



Quote:
Rows do not have timestamps associated with them. You might be able to make
some guesses using your logfile. If this is something you want for the
future you can add a timestamp field to your table and use a trigger to
keep it up to date.
uhm, *digs toe into ground* where would my logfile be?


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
  #5  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: Datestamps - 01-09-2004 , 03:39 PM



On Fri, Jan 09, 2004 at 13:12:12 -0800,
Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
Quote:
Rows do not have timestamps associated with them. You might be able to make
some guesses using your logfile. If this is something you want for the
future you can add a timestamp field to your table and use a trigger to
keep it up to date.

uhm, *digs toe into ground* where would my logfile be?
The logs might just be being thrown away. They might be being stored using
syslog in which case they would probably be in var/log somewhere. They
might be being saved into a file. Look at the commands used to start
the database server in this case to see where the file is.
For my use I save the logs using multilog, but I don't think any
distributor sets up postgres that way.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #6  
Old   
Steve Crawford
 
Posts: n/a

Default Re: Datestamps - 01-09-2004 , 03:47 PM



On Friday 09 January 2004 12:52 pm, Bruno Wolff III wrote:
Quote:
On Fri, Jan 09, 2004 at 12:25:45 -0800,

Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
On Fri, 2004-01-09 at 12:25, Bruno Wolff III wrote:
On Fri, Jan 09, 2004 at 11:45:17 -0800,

Bryan Irvine <bryan.irvine (AT) kingcountyjournal (DOT) com> wrote:
I am trying to figure out what day some things were entered
into the DB. Is there a way to do that?

Rows do not have timestamps associated with them. You might be
able to make some guesses using your logfile. If this is
something you want for the future you can add a timestamp field
to your table and use a trigger to keep it up to date.

I do I do!

What's the best way to create a field for tracking this?
Is this in the FAQ somewhere?

I don't think there is an FAQ, but it has been discussed on the
lists a few times. You probably want to use a before trigger to set
the timestamp column to current_timestamp on inserts or updates.
Creating a timestamp on inserts (not updates) is easy:

create table foo (....., mytimestamp timestamptz not null default
now(), ...);

Cheers,
Steve


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.