pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kaloyan Iliev <kaloyan@digsys.bg>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem with extract(epoch from interval ...
Date: Wed, 23 Jan 2013 13:23:22 +0200
Message-ID: <50FFC82A.3040305@digsys.bg> (raw)
In-Reply-To: <CAB8KJ=iKs9A4WHXkUt1PEuuxcj4ajBFr19VR2Ce56wJbKOs2Jw@mail.gmail.com>
References: <50FFC180.80507@digsys.bg>
	<CAB8KJ=iKs9A4WHXkUt1PEuuxcj4ajBFr19VR2Ce56wJbKOs2Jw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Thanks,
It works perfectly.

Regards,
  Kaloyan Iliev
On 23.01.13 13:00, Ian Lawrence Barwick wrote:
> Hi
>
> 2013/1/23 Kaloyan Iliev <kaloyan@digsys.bg>:
>> Hi,
>> I have a little problem with extract epoch from interval. It seems that the
>> query works if the interval is in a string but not from DB field.
>> Could someone provide support.
> (...)
>
> You have a casting error; instead of:
>
>> dbr=#  SELECT extract(EPOCH FROM INTERVAL b) FROM a;
>> ERROR:  syntax error at or near "b"
>> LINE 1: SELECT extract(EPOCH FROM INTERVAL b) FROM a;
> use
>
> SELECT extract(EPOCH FROM b::INTERVAL) FROM a;
>
> or
>
>
> SELECT extract(EPOCH FROM CAST (b AS INTERVAL)) FROM a;
>
>
> Regards
>
> Ian Barwick



-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <50FFC82A.3040305@digsys.bg>
Permalink:  ../50FFC82A.3040305@digsys.bg/
Also on:    postgresql.org/message-id/50FFC82A.3040305@digsys.bg

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kaloyan@digsys.bg
  Subject: Re: Problem with extract(epoch from interval ...
  In-Reply-To: <50FFC82A.3040305@digsys.bg>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox