pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kris Jurka <books@ejurka.com>
Cc: Dave Smith <dave.smith@candata.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Problem with fixed length fields.
Date: Sun, 24 Oct 2004 10:21:11 +1300
Message-ID: <417ACB47.3090101@opencloud.com> (raw)
In-Reply-To: <27388.1098564647@sss.pgh.pa.us>
References: <1098532450.2684.3.camel@davehome>
	<Pine.BSO.4.56.0410231239390.19312@leary.csoft.net>
	<26657.1098556819@sss.pgh.pa.us>
	<417AC2C2.40605@opencloud.com>
	<27388.1098564647@sss.pgh.pa.us>

Tom Lane wrote:
> Oliver Jowett <oliver@opencloud.com> writes:
> 
>>Tom Lane wrote:
>>
>>>Can you refrain from assigning a type at all?
> 
> 
>>Pushing on blindly with a Bind without knowing the actual type of the 
>>parameters you're sending seems possible but dangerous. It'd preclude 
>>using binary-format parameters for unknown types, at a minimum.
> 
> 
> I had in mind doing this *only* for setString; you would essentially be
> assuming that the resolved type was text, varchar, or char, which have
> interchangeable binary formats.

But the driver has no guarantee that the backend will infer one of these 
particular types, right?

> It would probably be a good idea to do a Describe Statement to verify
> that the parameter got resolved as one of those, but this need not add
> a round-trip, since you could issue it with the Parse message.

Currently the driver issues Parse, Bind, Describe(portal), Execute, 
Sync. If I understand correctly, you're suggesting we do Parse, 
Describe(statement), Bind, Describe(portal), Execute, Sync.

If the backend infers something other than a text-based type in Parse, 
doesn't Bad Stuff happen? (e.g. inserting random data into your database..)

We could certainly notice the type mismatch when the results of the 
statement Describe come back, but by then it is too late, the query has 
already been executed.

-O



view thread (8+ messages)  latest in thread

Message-ID: <417ACB47.3090101@opencloud.com>
Permalink:  ../417ACB47.3090101@opencloud.com/
Also on:    postgresql.org/message-id/417ACB47.3090101@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, tgl@sss.pgh.pa.us, books@ejurka.com, dave.smith@candata.com
  Subject: Re: Problem with fixed length fields.
  In-Reply-To: <417ACB47.3090101@opencloud.com>
  References: <1098532450.2684.3.camel@davehome> <Pine.BSO.4.56.0410231239390.19312@leary.csoft.net> <26657.1098556819@sss.pgh.pa.us> <417AC2C2.40605@opencloud.com> <27388.1098564647@sss.pgh.pa.us> <417ACB47.3090101@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox