Skip site navigation (1) Skip section navigation (2)

Re: timestamp precision

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: A Gilmore <agilmore(at)shaw(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamp precision
Date: 2004-09-13 07:30:56
Message-ID: DA1FEFB6-0556-11D9-9715-000A95C88220@myrealbox.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Sep 13, 2004, at 4:19 PM, A Gilmore wrote:

> Hello,
>
> Im using the default precision for my timestamps, 6.  Is it safe to 
> declare this column unique?

The *only* way to ensure uniqueness in a column is to explicitly 
declare the column UNIQUE or PRIMARY (which implies UNIQUE NOT NULL 
iirc). So if you declare it unique, of course it's safe.

If you are assuming it's unique because of the high precision, well, 
you might get lucky, and you might not. (Some might even argue that 
it's for all intents and purposes unique). However, if you want to 
guarantee uniqueness, declare it UNIQUE.

Michael Glaesemann
grzm myrealbox com


In response to

Responses

pgsql-novice by date

Next:From: Adrian ChewDate: 2004-09-13 09:38:28
Subject: having problem connecting to postgreSQL v7.5.
Previous:From: A GilmoreDate: 2004-09-13 07:19:26
Subject: timestamp precision

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group