Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.3/8.9.3) with ESMTP id MAA62397 for ; Fri, 30 Apr 1999 12:11:31 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id MAA28980; Fri, 30 Apr 1999 12:10:08 -0400 (EDT) To: JT Kirkpatrick cc: "'pgsql-sql@hub.org'" Subject: Re: [SQL] finding the most recent records In-reply-to: Your message of Fri, 30 Apr 1999 10:31:06 -0400 <01BE92F4.8E44C660.jt-kirkpatrick@mpsllc.com> Date: Fri, 30 Apr 1999 12:10:08 -0400 Message-ID: <28978.925488608@sss.pgh.pa.us> From: Tom Lane JT Kirkpatrick writes: > "field1 datetime not null default text 'now'". you'll only run into a > problem if more than one record is inserted AT THE EXACT SAME SECOND > -- but postgres will just put the same timestamp in there (don't > define the field as unique). Actually, I think "now" means "the time at the start of the current transaction", so that you'll get the same timestamp applied to all records inserted within a transaction. This is good for some things; for example, you can insert related records into several different tables and expect them to have the same timestamp, even though the operation may take more than a second to complete. But it does mean that you can't expect a timestamp to serve as a unique ID. (Use a SERIAL column for that, instead...) regards, tom lane