Re: Confusion over Python drivers

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andrew McNamara <andrewm(at)object-craft(dot)com(dot)au>
Cc: Florian Weimer <fw(at)deneb(dot)enyo(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Confusion over Python drivers
Date: 2010-02-08 23:34:25
Message-ID: 1265672065.29919.2466.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2010-02-09 at 09:15 +1100, Andrew McNamara wrote:
> I can't see how this would work with binary query parameters - the server
> will see a blob of binary data and have no way to know what it represents.

Unknown is unknown, whether in binary or text format. As far as I know,
PostgreSQL never looks inside a literal of unknown type to try to
determine its type -- it only looks at the context (to what function is
it an argument?).

For instance:

SELECT '5'; -- has no idea what type it is

SELECT '5' + 1; -- it's an int

SELECT 'a' + 1; -- it's still an int
ERROR: invalid input syntax for integer: "a"
LINE 1: SELECT 'a' + 1;

SELECT '5.0' + 1; -- still an int, bad input format
ERROR: invalid input syntax for integer: "5.0"
LINE 1: SELECT '5.0' + 1;

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew McNamara 2010-02-08 23:46:54 Re: Confusion over Python drivers
Previous Message Tom Lane 2010-02-08 23:09:19 Re: Writeable CTEs and empty relations