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: Dirk Schaller
Subject: RE: [Phpgroupware-developers] Patches for PostgreSQL??
Date: Wed, 26 Nov 2003 15:24:12 +0100

Hi,

you can find a syl style guide from Kai here:
http://www.probusiness.de/projekte/phpgroupware/sql_style_guide.html

Dirk 

> -----Original Message-----
> From: Brian Johnson [mailto:address@hidden
> Sent: Tuesday, November 25, 2003 5:09 PM
> To: address@hidden
> Subject: Re: [Phpgroupware-developers] Patches for PostgreSQL??
> 
> 
> 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
> >
> 
> 
> 
> _______________________________________________
> 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]