Re: Text->Date conversion in a WHERE clause
| От | Tom Lane |
|---|---|
| Тема | Re: Text->Date conversion in a WHERE clause |
| Дата | |
| Msg-id | 4703.1129155647@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Text->Date conversion in a WHERE clause (Collin Peters <cadiolis@gmail.com>) |
| Список | pgsql-sql |
Collin Peters <cadiolis@gmail.com> writes: > WHERE cust3 <> '' > AND cust3::text::timestamp > CURRENT_DATE - interval '1 month' > This results in the error 'ERROR: date/time field value out of range: > "052-44-5863"'. Now that is obviously not a valid date.... but there > is actually more to the where clause and the first part of it excludes > all rows where the user is not even the correct type, so the row which > includes the field '052-44-5863' should really not even be checked. Your mistake is in supposing that WHERE clauses are guaranteed to be evaluated in a particular order. Such guarantees are made only for a very few specific constructs such as CASE. See http://www.postgresql.org/docs/8.0/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL regards, tom lane
В списке pgsql-sql по дате отправления: