473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

timestamp and date behaviour with '-infinity'

Timestamps support infinity. However if appears dates do not.

When timestamps are cast to dates, there is no output. Is this an acceptable option or not?

Below are a number of examples showing what I am experiencing.

The last own shows how converting timestamps to dates and then ordering doesn't give you the
order you want. Maybe you should just order by the timestamp to begin with. However
Date does not understand infinity at all.

So as much as what I have said is confusing.

1. Is the output acceptable?
2. should there be infinity support for dates?
3. if not, how should -infinity timestamp converted to a date.
4. Am I missing the point here.

Regards

Russell Smith

church=# select '-infinity'::timestamp;
timestamp
-----------
-infinity
(1 row)

church=# select '-infinity'::timestamp::date;
date
------

(1 row)

church=# select '*' || '-infinity'::timestamp::date || '*';
?column?
----------

(1 row)

church=# select '*' || '-infinity'::timestamp::date::text || '*';
?column?
----------

(1 row)

church=# select '*' || '-infinity'::timestamp || '*';
?column?
-------------
*-infinity*
(1 row)

church=# select '*' || '-infinity'::timestamp::date || '*';
?column?
----------

(1 row)

church=# select '-infinity'::timestamp::date as a, '-inf' UNION select 'infinity'::timestamp::date as a, 'inf' ORDER BY a ASC;
a | ?column?
---+----------
| -inf
| inf
(2 rows)

church=# select '-infinity'::timestamp::date as a, '-inf' UNION select 'infinity'::timestamp::date as a, 'inf' ORDER BY a DESC;
a | ?column?
---+----------
| -inf
| inf
(2 rows)

church=# select '-infinity'::timestamp::date::timestamp;
timestamp
-----------

(1 row)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
2 4320
On Mon, 30 Aug 2004, Russell Smith wrote:
Timestamps support infinity. However if appears dates do not.

When timestamps are cast to dates, there is no output. Is this an acceptable option or not?


It looks to me that it turns into a NULL date. I'm not sure why it's
doing that rather than an error, though.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Russell Smith <mr*****@pws.com.au> writes:
Timestamps support infinity. However if appears dates do not.


There is a TODO item to fix that, but it hasn't gotten to the top of
anyone's priority list ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: praba kar | last post by:
Dear All, In Php strtotime() will change a date string into timestamp. I want to know which python function will change a date string into timestamp. Date string format is below
3
by: Michael Hertz | last post by:
I am performing a XSLT stylesheet on a XML document and produce a new XML document. How can I insert in this new XML stylesheet a tag <currtime>..."the current date/time"....</currtime> where...
3
by: Shelly | last post by:
Can anyone help? Here is what I have (part, at least) echo $dbResult . ' ' . $dbResult . ' ' . $dbResult . " " . date("M j, Y, g:i a", $dbResult) . '<br>'; Here is what it puts out ...
2
by: Jim Piellier | last post by:
I use desinger to generate ddl script. in some tables, I have table column using timestamp, but in generated ddl, all timestamp type became date, anyone know why? and how can I fix it? oracle...
7
by: Ross | last post by:
Hi, I want to change this query SELECT current timestamp FROM sysibm.sysdummy1; so it returns 2005-11-09-00.00.0.000000 not 2005-11-09-15.31.33.132000. Basically stip the time of the timestamp...
2
by: Campano, Troy | last post by:
Hi, I'm trying to compare a timestamp to current_timestamp but I'm having trouble. I want to compare just the date piece of my timestamp column to just the date piece of current_timestamp. ...
4
by: hph | last post by:
Okay, another trivial matter that I can't solve. I have a variable - $lastdate - that is the latest date any record in a MySQL database was updated. Its MySQL format is TIMESTAMP. If I say I...
3
by: krithikas | last post by:
I have a table (which i cannot modify) where date and time fields are stored as VARCHAR. But i have to cast these fields into timestamp. My requirement is like, timestamp (select date, time where...
1
by: PeterEBM | last post by:
Can anyone help with my embedded SQL in a old mainframe COBOL application that also runs on Windows. The SQL that is failing is a pretty standard SELECT and in the WHERE clause I am comparing some...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.