From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
---|---|
To: | Ken Johanson <pg-user(at)kensystem(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Strict-typing benefits/costs |
Date: | 2008-02-16 15:06:09 |
Message-ID: | 3B329809-551E-47DA-8FE9-BC7CFC88A2EC@seespotcode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Feb 15, 2008, at 18:11 , Ken Johanson wrote:
> Tom, is it accurate to assume that newer PG versions will further
> tighten type-strictness (say, '2008-01-01' presently being
> comparable to a datetime)? Also, do you know of any other vendors
> that are heading in this direction (removing by default the
> autocasts)?
'2008-01-01' does not indicate some kind of string: it's just an
untyped literal. Postgres will determine its type in context. For
example:
test=# select 'today is ' || '2008-02-16';
?column?
---------------------
today is 2008-02-16
(1 row)
|| is a string concatenation operator, so '2008-02-16' is treated as
a string: it's not cast from date to text: from Postgres' eyes, it
never was a date.
test=# select '2008-02-15' > CURRENT_DATE;
?column?
----------
f
(1 row)
Here, we're comparing against a date type, so Postgres treats
'2008-02-15' as a date.
Michael Glaesemann
grzm seespotcode net
From | Date | Subject | |
---|---|---|---|
Next Message | Phoenix Kiula | 2008-02-16 15:07:16 | Re: Timestamp indexes (why ">" or "between" does not use index?) |
Previous Message | Phoenix Kiula | 2008-02-16 14:42:48 | Timestamp indexes (why ">" or "between" does not use index?) |