Re: ERROR: invalid value "????" for "YYYY"

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: ERROR: invalid value "????" for "YYYY"
Дата
Msg-id 1381368224223-5773944.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: ERROR: invalid value "????" for "YYYY"  (Brian Wong <bwong@imageworks.com>)
Список pgsql-general
Brian Wong-2 wrote
> But from a user's perspective, why would it ever make sense that by adding
> an additional where clause, it actually brings in more data into the
> picture?  If I have query returning 100 rows.  Adding an additional where
> clause should only cut down the number of rows, not increase it.  And the
> extra data that's showing up is being added to the resultset cuz without
> the additional where clause, the result set did not contain any of those
> rows like pg_statistics/etc.

No it does not.  Your general case is flawed in that adding an OR condition
will indeed cause more rows to be added.  In this case you are adding an AND
clause but since it is at the same level as the existing conditions all
possible records must evaluate against this new clause even if one of the
other clauses returns false.  There is no short-circuiting.  This may be
confusing but that is part of the education process.  If that expression
(the one in the where clause) did not cause an error there would be at most
the same number of records output as the original query.  And the same
number of rows are being processed at the WHERE clause in both cases.  Since
one of the conditions only makes sense on a sub-set of valid rows there must
be two levels of WHERE clauses in the query - or use CASE regexp THEN test
ELSE false END so the substring test only is performed against valid table
names.

David J.









--
View this message in context:
http://postgresql.1045698.n5.nabble.com/ERROR-invalid-value-for-YYYY-tp5773787p5773944.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: Brian Wong
Дата:
Сообщение: Re: ERROR: invalid value "????" for "YYYY"
Следующее
От: ginkgo36
Дата:
Сообщение: Re: String reverse funtion?