Tom Lane wrote:
> Mario Splivalo writes:
>> But, date_trunc behaves like round function: round(1.9) = 2.
>
> Hmm ... only for float timestamps, and only for the millisec/microsec
> cases.
>
> case DTK_MILLISEC:
> #ifdef HAVE_INT64_TIMESTAMP
> fsec = (fsec / 1000) * 10
On Tue, 2009-06-30 at 10:22 +1000, Robert Edwards wrote:
> Would this be in addition to a unique constraint on (a, b, c) (for the
> cases where c is not null)?
That depends on your app's needs. Do you need to enforce uniqueness of
(a,b,c) ? Or of (a,b) where c is _not_ null? If so, then yes, that
Thanks for all these great ideas!
Craig Ringer wrote:
On Mon, 2009-06-29 at 15:42 +1000, Robert Edwards wrote:
Can anyone suggest a way that I can impose uniqueness on a and b when
c is NULL?
One way is to add an additional partial index on (a,b):
CREATE INDEX bobtest_ab_unique ON bobtest(
Mario Splivalo writes:
> But, date_trunc behaves like round function: round(1.9) = 2.
Hmm ... only for float timestamps, and only for the millisec/microsec
cases.
case DTK_MILLISEC:
#ifdef HAVE_INT64_TIMESTAMP
fsec = (fsec / 1000) * 1000;
#else
fsec =
Craig Ringer writes:
> On Mon, 2009-06-29 at 15:42 +1000, Robert Edwards wrote:
>> Can anyone suggest a way that I can impose uniqueness on a and b when
>> c is NULL?
> One way is to add an additional partial index on (a,b):
> CREATE INDEX bobtest_ab_unique ON bobtest(a,b) WHERE (c IS NULL);
Tha
On Mon, 2009-06-29 at 15:42 +1000, Robert Edwards wrote:
> Can anyone suggest a way that I can impose uniqueness on a and b when
> c is NULL?
One way is to add an additional partial index on (a,b):
CREATE INDEX bobtest_ab_unique ON bobtest(a,b) WHERE (c IS NULL);
... however, if you want to do
It's stated in the docs that date_trunc is "conceptually similar to the
trunc function for numbers.".
So, trunc(1.1) = 1, trunc(1.9) = 1, and so on.
But, date_trunc behaves like round function: round(1.9) = 2.
Example:
idel=# select date_trunc('milliseconds', '2009-01-01
12:15:00.000999+02'::ti
In response to Leo Mannhart :
> On Mon, 2009-06-29 at 17:08 +1000, Robert Edwards wrote:
> > A. Kretschmer wrote:
> > > In response to Robert Edwards :
> > >> Can anyone suggest a way that I can impose uniqueness on a and b when
> > >> c is NULL?
> > >
> > > Sure, use a functional index:
> > >
>
In response to Robert Edwards :
> A. Kretschmer wrote:
> >In response to Robert Edwards :
> >>Can anyone suggest a way that I can impose uniqueness on a and b when
> >>c is NULL?
> >
> >Sure, use a functional index:
> >
> >test=# create table bobtest (a int, b int, c int);
> >CREATE TABLE
> >test=*
On Mon, 2009-06-29 at 17:08 +1000, Robert Edwards wrote:
> A. Kretschmer wrote:
> > In response to Robert Edwards :
> >> Can anyone suggest a way that I can impose uniqueness on a and b when
> >> c is NULL?
> >
> > Sure, use a functional index:
> >
> > test=# create table bobtest (a int, b int, c
Thanks to all...
in effect it is a very little problem if you consider that probably I
will call psql from normal accounts...
:-)
thanks
Il giorno dom, 28/06/2009 alle 01.04 +0930, Shane Ambler ha scritto:
> Guillaume Lelarge wrote:
> > Hi Ivan,
> >
> > Le vendredi 26 juin 2009 à 17:53:15, iva
A. Kretschmer wrote:
In response to Robert Edwards :
Can anyone suggest a way that I can impose uniqueness on a and b when
c is NULL?
Sure, use a functional index:
test=# create table bobtest (a int, b int, c int);
CREATE TABLE
test=*# create unique index idx_bobtest on
bobtest(a,b,coalesce(c
12 matches
Mail list logo