Why select 1 where current_date = 'infinity'; doesn't work?

Started by Francisco Figueiredo Jr.over 17 years ago5 messagesgeneral
Jump to latest
#1Francisco Figueiredo Jr.
francisco@npgsql.org

It gives me the following error:

ERROR: invalid input syntax for type date: "infinity"

I thought I could use it anywhere in my sql.

I have to add a cast to timestamp in order for this to work. I thought
I wouldn't need to use a case.

Am I missing something?

Thanks in advance.

--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

#2Francisco Figueiredo Jr.
francisco@npgsql.org
In reply to: Francisco Figueiredo Jr. (#1)
Re: Why select 1 where current_date = 'infinity'; doesn't work?

On Tue, Oct 14, 2008 at 12:58 PM, Francisco Figueiredo Jr.
<francisco@npgsql.org> wrote:

It gives me the following error:

ERROR: invalid input syntax for type date: "infinity"

I thought I could use it anywhere in my sql.

I have to add a cast to timestamp in order for this to work. I thought
I wouldn't need to use a case.

Am I missing something?

Ok, I think I'm missing something...

Just after sending this message I noticed the current_timestamp
function which works like a charm.

Sorry for the noise.

--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Francisco Figueiredo Jr. (#2)
Re: Why select 1 where current_date = 'infinity'; doesn't work?

"Francisco Figueiredo Jr." <francisco@npgsql.org> writes:

ERROR: invalid input syntax for type date: "infinity"
I thought I could use it anywhere in my sql.

No, only timestamps support infinity.

We do have a TODO item to allow type date to do that too. It's been asked
for often enough, not sure why it hasn't happened. Seems easy enough,
maybe I'll go do it.

regards, tom lane

#4Francisco Figueiredo Jr.
francisco@npgsql.org
In reply to: Tom Lane (#3)
Re: Why select 1 where current_date = 'infinity'; doesn't work?

On Tue, Oct 14, 2008 at 1:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"Francisco Figueiredo Jr." <francisco@npgsql.org> writes:

ERROR: invalid input syntax for type date: "infinity"
I thought I could use it anywhere in my sql.

No, only timestamps support infinity.

We do have a TODO item to allow type date to do that too. It's been asked
for often enough, not sure why it hasn't happened. Seems easy enough,
maybe I'll go do it.

Thank you very much, Tom, for your feedback on this!!

I will update our forum discussion with this information.

I know this may sound a little bit uncommon, but to me it's an honor
to know you are paying attention to my message! :)

Thanks again.

--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://fxjr.blogspot.com
http://www.npgsql.org

#5Stephen Frost
sfrost@snowman.net
In reply to: Tom Lane (#3)
Re: Why select 1 where current_date = 'infinity'; doesn't work?

* Tom Lane (tgl@sss.pgh.pa.us) wrote:

We do have a TODO item to allow type date to do that too. It's been asked
for often enough, not sure why it hasn't happened. Seems easy enough,
maybe I'll go do it.

It's certainly be useful for us..

Thanks,

Stephen