pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or above
3+ messages / 3 participants
[nested] [flat]

* datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or above
@ 2001-03-02 16:02  bangh <banghe@baileylink.net>
  0 siblings, 2 replies; 3+ messages in thread

From: bangh @ 2001-03-02 16:02 UTC (permalink / raw)
  To: Joel Burton <jburton@scw.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Jeremy Buchmann <jeremy@wellsgaming.com>; pgsql-admin


Actually, it is not so simple.

How can you do this in psql 7.0 or above?
datetimeField = datetimeField - '30minutes'::timespan ( in psql 6.3, 6.5 you can),

while if you use type timestamp, instead of datetime
timestampField = timestampField - '30minutes'::interval
 you will get error msg.:
No such function 'datetime_stamp' with the specified attributes

--
Banghe



Joel Burton wrote:

>
> Is there anything that datetime did that timestamp doesn't?
>
> Could you
>
>    pg_dump | sed | psql
>
> to change the datetimes to timestamp?
>
> --
> Joel Burton   <jburton@scw.org>
> Director of Information Systems, Support Center of Washington




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

* Re: datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or  above
@ 2001-04-30 15:35  Joel Burton <jburton@scw.org>
  parent: bangh <banghe@baileylink.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Joel Burton @ 2001-04-30 15:35 UTC (permalink / raw)
  To: bangh <banghe@baileylink.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Jeremy Buchmann <jeremy@wellsgaming.com>; pgsql-admin

On Fri, 2 Mar 2001, bangh wrote:

> Actually, it is not so simple.
> 
> How can you do this in psql 7.0 or above?
> datetimeField = datetimeField - '30minutes'::timespan ( in psql 6.3, 6.5 you can),
> 
> while if you use type timestamp, instead of datetime
> timestampField = timestampField - '30minutes'::interval
>  you will get error msg.:
> No such function 'datetime_stamp' with the specified attributes
> 
> --
> Banghe

> > Is there anything that datetime did that timestamp doesn't?
> >
> > Could you
> >
> >    pg_dump | sed | psql
> >
> > to change the datetimes to timestamp?

Interesting. Works fine w/7.1. I don't have a 7.0 db running anywhere to
see that this fails under 7.0.

BTW, I was being far to simplistic in suggesting that
you should pipe pg_dump to sed to psql. As was pointed out,
redirect pg_dump to a file, sed/perl/edit that, then redirect from that to
psql.

HTH,
-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington




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

* Re: datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or above
@ 2001-04-30 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: bangh <banghe@baileylink.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2001-04-30 15:50 UTC (permalink / raw)
  To: bangh <banghe@baileylink.net>; +Cc: Joel Burton <jburton@scw.org>; Jeremy Buchmann <jeremy@wellsgaming.com>; pgsql-admin

bangh <banghe@baileylink.net> writes:
> while if you use type timestamp, instead of datetime
> timestampField = timestampField - '30minutes'::interval
>  you will get error msg.:
> No such function 'datetime_stamp' with the specified attributes

I see no such problem in either 7.0 or 7.1 ...

regression=# create table foo1 (f1 timestamp);
CREATE
regression=# insert into foo1 values(now());
INSERT 832069 1
regression=# update foo1 set f1 = f1 - '30minutes'::interval;
UPDATE 1
regression=#

			regards, tom lane



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


end of thread, other threads:[~2001-04-30 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-02 16:02 datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or above bangh <banghe@baileylink.net>
2001-04-30 15:35 ` Re: datetimeField = datetimeField - '30minutes'::timespan in psql 7.0 or  above Joel Burton <jburton@scw.org>
2001-04-30 15:50 ` Tom Lane <tgl@sss.pgh.pa.us>

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