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



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

Reply via email to