pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Data type conversion
3+ messages / 3 participants
[nested] [flat]

* Data type conversion
@ 2003-10-03 07:23  Jan Pips <jan_pips@op.pl>
  0 siblings, 2 replies; 3+ messages in thread

From: Jan Pips @ 2003-10-03 07:23 UTC (permalink / raw)
  To: pgsql-sql

How to convert the interval type into integer, float or any "countable" data
type at the time of table creation using
select ... into?

Pips





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Data type conversion
@ 2003-10-03 16:20  Jeff Boes <jboes@nexcerpt.com>
  parent: Jan Pips <jan_pips@op.pl>
  1 sibling, 0 replies; 3+ messages in thread

From: Jeff Boes @ 2003-10-03 16:20 UTC (permalink / raw)
  To: pgsql-sql

Jan Pips wrote:
> How to convert the interval type into integer, float or any "countable" data
> type at the time of table creation using
> select ... into?
> 

I'm guessing you want something like this:

SELECT EXTRACT('EPOCH' FROM INTERVAL
     '1 days 4 hours 15 minutes 23 seconds');


-- 
Jeff Boes                                      vox 269.226.9550 ext 24
Database Engineer                                     fax 269.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
            ...Nexcerpt... Extend your Expertise




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Data type conversion
@ 2003-10-03 19:44  Bruno Wolff III <bruno@wolff.to>
  parent: Jan Pips <jan_pips@op.pl>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruno Wolff III @ 2003-10-03 19:44 UTC (permalink / raw)
  To: Jan Pips <jan_pips@op.pl>; +Cc: pgsql-sql

On Fri, Oct 03, 2003 at 09:23:46 +0200,
  Jan Pips <jan_pips@op.pl> wrote:
> How to convert the interval type into integer, float or any "countable" data
> type at the time of table creation using
> select ... into?

You can use extract to do that. See the date/time function documentation.
Note that months get treated as 30 days when extracting periods less
than a month from an interval.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-10-03 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-03 07:23 Data type conversion Jan Pips <jan_pips@op.pl>
2003-10-03 16:20 ` Jeff Boes <jboes@nexcerpt.com>
2003-10-03 19:44 ` Bruno Wolff III <bruno@wolff.to>

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