Re: Strict-typing benefits/costs
От | Michael Glaesemann |
---|---|
Тема | Re: Strict-typing benefits/costs |
Дата | |
Msg-id | 3B329809-551E-47DA-8FE9-BC7CFC88A2EC@seespotcode.net обсуждение исходный текст |
Ответ на | Re: Strict-typing benefits/costs (Ken Johanson <pg-user@kensystem.com>) |
Ответы |
Re: Strict-typing benefits/costs
Re: Strict-typing benefits/costs |
Список | 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
В списке pgsql-general по дате отправления: