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: Brian Johnson
Subject: Re: [Phpgroupware-developers] Patches for PostgreSQL??
Date: Tue, 25 Nov 2003 16:09:28 +0000

I think we're kind of going in the same direction with this .. all apps need to 
have
their SQL rewritten where this problem occurs

I think it has been done with the core apps, and can be done for other apps as
problems are encountered

Perhaps a section on SQL writing should be included in the dev docs on the wiki
1. this
2. don't include semi colons at end
3. urls to function for mysql, msql, and pgsql for cross comparison
etc


Dani Oderbolz (address@hidden) wrote:
>
>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
>
>
>
>
>_______________________________________________
>Phpgroupware-developers mailing list
>address@hidden
>http://mail.gnu.org/mailman/listinfo/phpgroupware-developers
>





reply via email to

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