Re: Confusion over Python drivers

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Confusion over Python drivers
Дата
Msg-id 1265689219.29919.2570.camel@jdavis
обсуждение исходный текст
Ответ на Re: Confusion over Python drivers  (Andrew McNamara <andrewm@object-craft.com.au>)
Список pgsql-hackers
On Tue, 2010-02-09 at 13:56 +1100, Andrew McNamara wrote:
> >For a given type, the input function may be more likely to catch an
> >input error than the recv function; or the reverse. Either way, it is
> >very type-specific, and the only difference is the whether the input is
> >misinterpreted (type error not caught; bad) or an error is thrown (type
> >error caught; better). 
> 
> This is the crux of the matter: the type input functions are universally
> more forgiving since, by their nature, text formats are designed for us
> fuzzy humans, and users of adapters have come to expect this. 

Except that it's exactly the opposite with integers. Pass any 4 bytes to
in4recv(), and it will accept it. However, try passing '4.0' to
int4in(), and you get an error.

If I had to make an educated guess about the forgiveness of various type
input and type recv functions, I would say that the recv functions are
more forgiving. After all, you would expect the binary format to be less
redundant, and therefore less likely to catch inconsistencies. I don't
see much of a universal truth there, however.

This is getting pretty far off-topic, so let's just leave it at that.
The drivers should support both formats; the type inference logic
doesn't care at all about the contents of the unknown literals (text or
binary); and queries should be written in such a way that the types are
unambiguous and unsurprising.

Regards,Jeff Davis



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

Предыдущее
От: M Z
Дата:
Сообщение: Re: CVS checkout source code for different branches
Следующее
От: M Z
Дата:
Сообщение: Re: CVS checkout source code for different branches