Skip site navigation (1) Skip section navigation (2)

Re: Patch for DBD::Pg pg_relcheck problem

From: David Wheeler <david(at)wheeler(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Ian Barwick <barwick(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,dbi-dev(at)perl(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Patch for DBD::Pg pg_relcheck problem
Date: 2002-12-15 01:58:17
Message-ID: ADD3699E-0FD0-11D7-8FFE-0003931A964A@wheeler.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-interfaces
On Saturday, December 14, 2002, at 05:46  PM, Bruce Momjian wrote:

> I thought you had that figured out, by flagging the param as bytea
> somehow?  Are you thinking of something automatic?

No. Baldur Kristinsson points out that some people may pass a string 
with NUL characters to DBD::Pg to be inserted into something other than 
a bytea column. We have to figure out what to do when they do that. 
Baldur Kristinsson thinks we should just quietly strip them out (and 
throw a warning). Others think that it should throw an exception and 
croak. Tim said:

   The driver should always try to be as transparent as possible.
   The general principle is "don't mes with the users data unless
   they've specifically asked you to (cf. ChopBlanks)".

Since, however, nulls aren't really allowed in any PostgreSQL data type 
(except bytea, and then only if specifically bound as such to a 
prepared statement), I'm not sure what to do about this. We can't leave 
the data alone unless we just want PostgreSQL to throw an error (likely 
to be a mysterious error, as the user won't know why her data is 
getting truncated).

I think...throw an exception, since PostgreSQL can't handle the null 
byte. Then it will be up to the user to clean up her data, and we won't 
have to touch it.

Thoughts?

David

-- 
David Wheeler                                     AIM: dwTheory
david(at)wheeler(dot)net                                 ICQ: 15726394
http://david.wheeler.net/                      Yahoo!: dew7e
                                                Jabber: Theory(at)jabber(dot)org


In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2002-12-15 02:35:07
Subject: Re: Patch for DBD::Pg pg_relcheck problem
Previous:From: Bruce MomjianDate: 2002-12-15 01:46:53
Subject: Re: Patch for DBD::Pg pg_relcheck problem

pgsql-interfaces by date

Next:From: Bruce MomjianDate: 2002-12-15 02:35:07
Subject: Re: Patch for DBD::Pg pg_relcheck problem
Previous:From: Bruce MomjianDate: 2002-12-15 01:50:13
Subject: python bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group