phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] Patches for PostgreSQL??


From: Dani Oderbolz
Subject: Re: [Phpgroupware-developers] Patches for PostgreSQL??
Date: Tue, 25 Nov 2003 12:13:17 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624

Brian Johnson wrote:

The 'cause' is postgresl 7.3

They decided to change how they handle empty fields in this version

Its true that this Postgres change (ACK that they changed it) causes many 
problems.
But it cuases problems with queries which are, say, less than optimal.
Many people confuse '' by NULL for example, but this just is not the same!

Consider this code for example:

./phpgwapi/setup/tables_update_0_9_10.inc.php:                  $db2->query("SELECT 
account_lid FROM phpgw_accounts WHERE account_lid='$group_name'",__LINE__,__FILE__);


So, if  account_lid is not set you get this:
SELECT account_lid FROM phpgw_accounts WHERE account_lid=''


The resultset will contain all rows, whose account
is an empty string - which is allowed!
So logically, this is really bad.
The *Intention* however was this:
SELECT account_lid FROM phpgw_accounts WHERE account_lid IS NULL

Which cannot occour, because account_lid has a NOT NULL Constraint.

See the problem?


Cheers,
Dani






reply via email to

[Prev in Thread] Current Thread [Next in Thread]