Re: Converting a timestamp to a time

From: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Converting a timestamp to a time
Date: 2006-11-05 14:34:19
Message-ID: 454DF66B.2E0C0BD2@telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andreas Kretschmer schrieb:
>
> Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> wrote:
> > > test=# select now()::time;
> > > now
> > > ----------------
> > > 11:16:18.22527
> > > (1 row)
> >
> > Thanks Andreas, I've ended up using CAST( ... AS TIME). I think the ::
> > notation might be fragile in this instance because of the machine-generated
> > SQL which
>
> Thats okay, because my version (the ::cast) is a PostgreSQL-feature, but
> the cast(... as ...) is more SQL-conform.

Thanks for that, feedback on "best practice" is always useful.

I must admit that the only server I've used before pg was the "SOLID Server
(using Bonzai Tree technology)", but they changed their licensing terms which
made it impractical. I looked briefly at MySQL which in those days didn't
support transactions, apart from that we decided that we didn't fancy waving the
incredibly-tacky name in front of our customers :-)

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Staubo 2006-11-05 14:38:03 Re: varchar
Previous Message Alain Roger 2006-11-05 14:32:18 varchar